Python Crash Course CSC 576: Data Science
Today Python Crash Course HTML notebooks
IPython Robust environment for interactive and exploratory computing Enhanced python shell designed to accelerate the wiring, testing, and debugging of Python code Particularly useful for interactively working with data and visualizing data HTML notebook for connecting IPython through a web browser Infrastructure for interactive parallel and distributive computing
Installation Already included with Anaconda environment
Python 2 and Python 3 Python community is undergoing a drawn-out transition from Python 2 to Python 3 Python 3 is not backwards compatible! We will use Python 3 in this course The Grus textbook has very similar Python 2 code Updated Python 3 code for every example is available on the book’s website (linked from our course page under “Secondary Resources”)
IPython History Began in 2001 with the goal of making a better interactive Python interpreter Encourages an execute-explore workflow rather than the typical edit-compile-run workflow
IPython Basics Launch from within Anaconda Can execute arbitrary Python statements Output is pretty-printed a little better than the standard python interpreter Features tab completion Pressing tab will search the namespace for any variables matching the characters that you have typed so far
IPython HTML Notebook Started in 2011 Tool for interactive computing and reproducible research JSON based .ipynb document format Can start from within Anaconda
Using the Notebook An IPython notebook is made up of a number of cells. Each cell can contain Python code. Execute a cell by clicking on it and pressing Shift-Enter. Output of the cell will be displayed beneath the cell. Global variables are shared between cells.
References Python for Data Analysis, McKinney, 1st Edition Data Science from Scratch, Grus, 1st Edition