Setting Up Python Environment

Setting up Python environment consists of 4 main elements

  1. Install Python Environment and Necessary Tools
  2. Execute Python Commands
  3. Run Sample Python Program
  4. Install Python Packages

We will go with Python Anaconda distribution for our course because it has really comprehensive in terms of 3rd party packages and it is really powerful with it's own package manager; conda.

Installing Anaconda is straightforward: download the binary and follow the instructions. But careful to install Python 3.5 version.

If you are asked during the installation process whether you’d like to make Anaconda your default Python installation, say yes

the conda command is a tool that keep your packages organized and up to date.

Jupyter Notebook

Jupyter notebooks provide a browser-based interface to Python with:

  • The ability to write and execute Python commands directly in your browser
  • Formatted output also in the browser, including tables, figures, animation, etc.
  • The ability to mix in formatted text and mathematical expressions between cells

Let's Start Jupyter Notebook

Demonstration Starts

Dashboard

It's the main page when you hit http://localhost:8888/ .

Open a new File

Running Cells

Edit Mode

Shortcuts


In [1]:
import numpy as np
import matplotlib.pyplot as plt

N = 20
theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
radii = 10 * np.random.rand(N)
width = np.pi / 4 * np.random.rand(N)

ax = plt.subplot(111, polar=True)
bars = ax.bar(theta, radii, width=width, bottom=0.0)

# Use custom colors and opacity
for r, bar in zip(radii, bars):
    bar.set_facecolor(plt.cm.jet(r / 10.))
    bar.set_alpha(0.5)

plt.show()


Additional Software

We will be needing the QuantEcon.py package from QuantEcon organization.