As we see in the above line, the cell can be a text string. But it can also contain code, as seen below.
import pandas as pd
!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...
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.
!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.
##How to interrupt a long data step?
#Run this cell and then click on Kernel -> Interrupt on the Menu above.
range(10**10)
#Complete the line with a left parenthesis.
#Notice that it auto-completes the right parenthesis and displays the argument list
data = pd.read_csv
#You can also ask to see the doc string of a method by typing the question mark.
pd.read_csv?
http://ipython.org/ipython-doc/dev/interactive/tutorial.html
#One quick example:
%timeit range(1)
1000000 loops, best of 3: 220 ns per loop
http://nbviewer.ipython.org/github/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/blob/master/Chapter1_Introduction/Chapter1_Introduction.ipynb