This is an example of iPython notebook. The cell is a fundamental unit.

As we see in the above line, the cell can be a text string. But it can also contain code, as seen below.

In [1]:
import pandas as pd

Oops, looks like we don't have pandas installed. We can go back to the shell and install pandas, or we can leverage one of the cool features of the iPython notebook to interact with the shell directly.

In [3]:
!pip install pandas
Downloading/unpacking pandas
  Downloading pandas-0.15.0-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.whl (6.6MB): 6.6MB downloaded
Downloading/unpacking numpy>=1.7.0 (from pandas)
  Downloading numpy-1.9.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.6MB): 3.6MB downloaded
Downloading/unpacking python-dateutil (from pandas)
  Downloading python-dateutil-2.2.tar.gz (259kB): 259kB downloaded
  Running setup.py (path:/Users/jlin/.virtualenvs/python_data_science/build/python-dateutil/setup.py) egg_info for package python-dateutil
    
Downloading/unpacking pytz>=2011k (from pandas)
  Downloading pytz-2014.7.tar.bz2 (166kB): 166kB downloaded
  Running setup.py (path:/Users/jlin/.virtualenvs/python_data_science/build/pytz/setup.py) egg_info for package pytz
    
Downloading/unpacking six (from python-dateutil->pandas)
  Downloading six-1.8.0-py2.py3-none-any.whl
Installing collected packages: pandas, numpy, python-dateutil, pytz, six
  Running setup.py install for python-dateutil
    
  Running setup.py install for pytz
    
Successfully installed pandas numpy python-dateutil pytz six
Cleaning up...
In [4]:
import pandas as pd

We won't go into pandas in detail, since it has already been covered by John F.

The cool thing about the iPython notebook is that it is interactive. You can interact with the content of your data step-by-step.

In [17]:
!git clone https://github.com/pydata/pydata-book.git
Cloning into 'pydata-book'...
remote: Counting objects: 225, done.
remote: Total 225 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (225/225), 40.06 MiB | 1.54 MiB/s, done.
Resolving deltas: 100% (24/24), done.
Checking connectivity... done.
In [ ]:
##How to interrupt a long data step?
#Run this cell and then click on Kernel -> Interrupt on the Menu above.
range(10**10)

iPython Notebook provides programming support.

In [20]:
#Complete the line with a left parenthesis.
#Notice that it auto-completes the right parenthesis and displays the argument list
data = pd.read_csv
In [27]:
#You can also ask to see the doc string of a method by typing the question mark.
pd.read_csv?

ipython has lots of special features, such as magic commands. For more resources, check out:

http://ipython.org/ipython-doc/dev/interactive/tutorial.html

In [4]:
#One quick example:
%timeit range(1)
1000000 loops, best of 3: 220 ns per loop

There is also many cool ipython notebooks floating around. For example, see a book that was written in iPython Notebook format.

http://nbviewer.ipython.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter1_Introduction/Chapter1_Introduction.ipynb