Source: O’REILLY Python Fundamentals

Install Anaconda

Tthis particular distribution because of all the different software that comes with it by default.

In particular, it has the IPython interpreter which we will use to execute code both interactively one code snippet at a time, or one line of code at a time, as well as to execute full Python applications, which again, we refer to as scripts.

It also has a local Jupyter Notebooks server that will enable you to run this thing called Jupyter Notebooks in your Web browser locally on your computer.

As you’ll see in the test drives in lesson one, Jupyter Notebooks are a really convenient way to not only type and execute Python code, but you can also embed in them text and images and videos and other Web-based content to create a combination of both code and other materials.

That’s particularly important for reproducibility. If you’re doing data science studies or other types of studies and you want other people to be able to reproduce your results, Jupyter Notebooks are a really popular way of doing that.

In addition to IPython and Jupyter Notebooks, most of the Python and data science libraries that we use throughout these videos are included with the Anaconda Python distribution.

Execute a couple of commands to make sure that everything is fully up to date.

If you’re on Windows, you’re going to want to open the Anaconda Prompt. It’s important to execute that as administrator to ensure that the software is allowed to update your system.

Once you’ve gone and installed Anaconda, you’re going to have in your Start button, an Anaconda Prompt that’s available to you. You can look for it yourself through the Start menu or you can simply search for Anaconda Prompt down here in the search bar. As you can see, it pops up in the search list, and if I right click that, and select Run as Administrator, that’s the way that you’re going to want to ensure that you execute the Anaconda command prompt anytime that you intend to modify your system. Which happens when you’re updating the code. Once you agree to that, then you’ll see the Anaconda Prompt show up on your screen.

Execute two different commands,

conda update conda is going to install any updates to the tool called conda that you’ll be using frequently to install additional libraries. And then

conda update –allis going to look at all of the libraries, and other software that were installed when you installed the Anaconda Python distribution, and it will check for updates to all of them. It will also look at the dependencies between all those different software libraries, and tell you which individual pieces need to be updated.

– When you’re working with installing software in the context of Anaconda, there are two so-called package managers that you’re typically going to use and these are going to enable you to install what are known as packages. These are basically bundles of software that represent a given library or tool that you’d like to add to your Python distribution.

Now there are two key package managers,

the conda package manager and that package manager is not only going to enable you to install additional software but it also is going to be the tool that you use to manage Anaconda from the command line to do things like, create customer Anaconda environments which are important for example, for reproducibility or to add and remove those environments, activate those environments and also remove and install software as well.

There’s also one called pip and you’ll use both of these because in the case of pip, more packages are available through pip than are currently available through conda.

Dynamic animations that you can execute either with the iPython interpreter, or once again in the context of Jupyter Notebooks.

To get those animations to work correctly in the context of Jupyter, you’ll need to install a package called jupyter-matplotlib. Matplotlib is a graphics visualization package that is going to enable you to create some very impressive graphics with minimal amounts of code.

We’ll also be taking advantage of another library that’s built on top of matplotlib called Seaborn, and in order to use either of those two in the context of Jupyter for these dynamic animations, we will need this package first.

So to do that, you’re going to have to install, by its package name, which is actually ipympl. So these are the commands that you’ll need to execute for that purpose, and you’ll need to execute these commands one at a time.

  • conda install -c conda-forge ipympl
  • conda install nodejs
  • jupyter labextension install @jupyter-widgets/jupyterlab-manager
  • jupyter labextension install @jupyter-matplotlib

One of the fun and interesting things that you’ll do as you work your way into the higher lessons and chapters of our Python materials, is the “Data Mining Twitter” lesson. Now in this lesson, one of the things you are going to be doing is interacting with the Twitter APIs over the internet to do things like search for tweets on a specific topic, to analyze those tweets, to stream tweets live as they occur, and to analyze those live, and do things like perform sentiment analysis where you’re looking at each tweet’s text and trying to determine whether it’s positive or negative, or analyze them however you like.

Now in order to do that, Twitter is going to require you to have a developer account. So you’re going to need to register for access to using their APIs and that will give you the credentials that you need in order to work with a library that we use called Tweepi, which is going to make it really easy to interact with Twitter on your behalf.

Now to sign up for your own Twitter credentials, which you must do before you execute any of those Twitter-based examples in the Twitter lesson or in subsequent lessons that also have some Twitter processing in them, you will need to go to this website