|Day 1||Lecture 1||Intro and Setup||Why Python, Setup, etc|
|Day 1||Lecture 2||Basic Python||Syntax, data structures, control flow, etc|
|Day 2||Lecture 3||Numpy + Pandas I||Numpy basics, series/dataframe basics|
|Day 2||Lecture 4||Pandas II||Joining, advanced indexing, reshaping, etc|
|Day 3||Lecture 5||Pandas III||Grouping, apply, transform, etc|
|Day 3||Lecture 6||Plotting||Intro to plotting in Python|
|Day 3||Lecture 7||Intro to Modeling||Intro to stats/ML models in Python|
First, you're going to want to get a copy of this repository onto your
machine. Simply fire up
git and clone it:
Open up a shell (e.g.
Navigate to where you'd like to save this.
/Users/<user>/repos/on Mac, or
Clone this repo:
git clone https://github.com/ihmeuw/ihme-python-course.git
Python is a widely used high-level, general-purpose, interpreted, dynamic programming language.
Officially, Python is an interpreted scripting language (meaning that it is not compiled until it is run) for the C programming language; in fact, Python itself is coded in C (though there are other non-C implementations). It offers the power and flexibility of lower level (i.e. compiled) languages, without the steep learning curve and associated programming overhead. The language is very clean and readable, and it is available for almost every modern computing platform.
There are modules available for just about anything you could want to do in Python, with nearly 100,000 available on PyPI alone. Some notable packages:
DataFrameclass is useful for spreadsheet-like representation and mannipulation of data. Also includes high-level plotting functionality.
pythonat the command line will open up the standard Python interpreter:
Seldom used interactively - but we'll use it a lot for running completed programs, e.g.
IPython is an interactive interpreter for Python that adds many user-friendly features on top of the standard
Start IPython by simply calling
ipython from the command line:
Starting a Jupyter notebook server will launch a local webserver that you can view in your browser to create, view, and run notebooks:
Calling Spyder will open up a new project
Another interesting new IDE for Python is Rodeo
Go to the Anaconda download page and download the installer for Python 3.5 (64-bit) and simply click through to follow the instructions
from IPython.display import Markdown, display display(Markdown(open('./Exercise 1/README.md', 'r').read()))
See the README for instructions on how to install Anaconda on your system.
See the README again for instructions on cloning this repo
(into its recommended location of
pythonat the command line
1 + 1
1.0 + 1
jupyter notebookto startup a notebook server
8888it might start the server on a different port. Look for a message in your terminal like
to find it.
The Jupyter Notebook is running at: http://localhost:8889/
Lecture 1/Exercise 1directory and and then click on
test-notebook.ipynbto open it
RISEwill add a new button to your Jupyter toolbar that'll allow you to view these notebooks in slideshow mode
shift+spacebarto navigate through the slides
View > Cell Toolbar > Slideshow