This short primer on Python is designed to provide a rapid "on-ramp" for computer programmers who are already familiar with basic concepts and constructs in other programming languages to learn enough about Python to effectively use open-source and proprietary Python-based machine learning and data science tools.
The primer is spread across a collection of IPython Notebooks, and the easiest way to use the primer is to install IPython Notebook on your computer. You can also install Python, and manually copy and paste the pieces of sample code into the Python interpreter, as the primer only makes use of the Python standard libraries.
There are three versions of the primer. Two versions contain the entire primer in a single notebook:
- Single IPython Notebook: Python_for_Data_Science_all.ipynb
- Single web page (HTML): Python_for_Data_Science_all.html
The other version divides the primer into 5 separate notebooks:
- Introduction
- Data Science: Basic Concepts
- Python: Basic Concepts
- Using Python to Build and Use a Simple Decision Tree Classifier
- Next Steps
There are several exercises included in the notebooks. Sample solutions to those exercises can be found in two Python source files:
simple_ml.py
: a collection of simple machine learning utility functionsSimpleDecisionTree.py
: a Python class to encapsulate a simplified version of a popular machine learning model
There are also 2 data files, based on the mushroom dataset in the UCI Machine Learning Repository, used for coding examples, exploratory data analysis and building and evaluating decision trees in Python:
agaricus-lepiota.data
: a machine-readable list of examples or instances of mushrooms, represented by a comma-separated list of attribute valuesagaricus-lepiota.attributes
: a machine-readable list of attribute names and possible attribute values and their abbreviations