2019-03-07-python

https://chendaniely-teaching.github.io/2019-03-07-python/

View the Project on GitHub chendaniely-teaching/2019-03-07-python

Setup

Python

Anaconda, an all-in-one installer, is recommended.

Regardless of how you choose to install it, please make sure you install Python version 3.x (e.g., 3.7 is fine).

When using the IPython notebook, a programming environment that runs in a web browser, you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported (some older browsers, including Internet Explorer version 9 and below, are not).

Windows

Video Tutorial

  1. Open http://continuum.io/downloads with your web browser.
  2. Download the Python 3 installer for Windows.
  3. Install Python 3 using all of the defaults for installation except make sure to check Make Anaconda the default Python.

Testing If Anaconda was installed

  1. Open up the Anaconda Command Prompt
  2. Type “ipython” into the prompt
  3. You should see Python open up with Python 3.7.x and using the Anaconda distribution
  4. Type “quit()” to exit
  5. Type “jupyer notebook” to launch the notebook (this may take a while if it is the first time you are launching it)
  6. Note the URL (with the token), paste it into your browser
  7. Close the anaconda prompt when you’re done

Installing Packages

To install the packages needed for the class you can follow the instructions below:

  1. Open your Anaconda Command prompt (Windows)
  2. Run the following lines of code
    • note that ctrl+v may not paste in windows, you can paste by pressing shift + insert, or by clicking the icon to the top left of the Anaconda Command promt then edit then paste

If you are just following along with the class, you may only need to run the following command:

conda install -c conda-forge feather-format

If you’re following along with the book, you might want to install everything else that is needed.

conda install -c conda-forge feather-format wget
pip install lifelines pandas-datareader

If you installed minicond, instead of anaconda, you would need to run the following commands to make sure you have everything.

conda install xlwt openpyxl seaborn statsmodels scikit-learn regex odo numba
conda install -c conda-forge feather-format wget
pip install lifelines pandas-datareader