{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction to IPython Notebook" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###Why do I use IPython notebook:\n", "* Interactive like a REPL\n", "* Durrable artifacts in cells\n", "* Shareable like a document...with built-in annotations!\n", "\n", "A motivating example..." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from __future__ import division, print_function\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "881.png Section3_bokeh.ipynb heat_3-2.png\r\n", "AAPL.hdf5 Section4_vtk.ipynb interestingBugs.jpg\r\n", "GOOG.hdf5 Section4_vtk.py iris.csv\r\n", "README.md Untitled0.ipynb python.png\r\n", "SaintHelens.vtk goog_fit.png selection.png\r\n", "Section0_intro.ipynb heat_1-1.png smooth_kernel.png\r\n", "Section1-1_ipython.ipynb heat_1-2.png smooth_power.png\r\n", "Section1-2_matplotlib-Live.ipynb heat_2-1.png smooth_signal.png\r\n", "Section1-2_matplotlib.ipynb heat_2-2.png\r\n", "Section2_numpy_scipy_pandas.ipynb heat_3-1.png\r\n" ] } ], "source": [ "!ls" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Index([u'Unnamed: 0', u'SepalLength', u'SepalWidth', u'PetalLength', u'PetalWidth', u'Species'], dtype='object')" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "iris = pd.read_csv(\"iris.csv\")\n", "iris.columns" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "0 5.1\n", "1 4.9\n", "2 4.7\n", "3 4.6\n", "4 5.0\n", "Name: SepalLength, dtype: float64" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#iris['SepalLength'].head()\n", "iris.SepalLength.head()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | Unnamed: 0 | \n", "SepalLength | \n", "SepalWidth | \n", "PetalLength | \n", "PetalWidth | \n", "Species | \n", "
---|---|---|---|---|---|---|
0 | \n", "1 | \n", "5.1 | \n", "3.5 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "
1 | \n", "2 | \n", "4.9 | \n", "3.0 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "
2 | \n", "3 | \n", "4.7 | \n", "3.2 | \n", "1.3 | \n", "0.2 | \n", "setosa | \n", "
3 | \n", "4 | \n", "4.6 | \n", "3.1 | \n", "1.5 | \n", "0.2 | \n", "setosa | \n", "
4 | \n", "5 | \n", "5.0 | \n", "3.6 | \n", "1.4 | \n", "0.2 | \n", "setosa | \n", "