Installation is easy. Optional: Use an enviroment like virtualenv to install the python code.
Install with pip: pip install iPython
Or download and install a scientific package, which delivers a lot of useful python libraries:
# this is a cell
# in a cell you can run python code
a = 10
b = 20
a + b
30
Tab completion is quite powerful in iPython.
You can supres the output with a ;
a + b;
_
30
a
10
__
30
_i
u'__'
In[3]
u'a + b;'
Out[2]
30
%history -l 10
a __ _i In[3] Out[2] %history –l 10 %history –l 10 %history –l %history? %history -l [10]
import sys
sys?
%ls?
Use shift tab over a function name to see the declaration information.
You can use the shell command (e.g. bash) with a !
!ls
01_numpy.ipynb
02_audio.ipynb
03_R.ipynb
04_Cython.ipynb
DataLab_final_logo__ColourURL_--UPDATED.png
Pandas.ipynb
Untitled0.ipynb
aapl_ohlc.csv
deepscore_cnn.py
deepscore_simple_1
mnist.pkl.gz
mnist.py
mnist.pyc
mnist_conv.py
png2pickle.ipynb
title.ipynb
Assigne to a python variable.
files = !ls
files
['01_numpy.ipynb', '02_audio.ipynb', '03_R.ipynb', '04_Cython.ipynb', 'DataLab_final_logo__ColourURL_--UPDATED.png', 'Pandas.ipynb', 'Untitled0.ipynb', 'aapl_ohlc.csv', 'deepscore_cnn.py', 'deepscore_simple_1', 'mnist.pkl.gz', 'mnist.py', 'mnist.pyc', 'mnist_conv.py', 'png2pickle.ipynb', 'title.ipynb']
IPython uses the full potential of modern web techonologies.
In Python, objects can declare their textual representation using the __repr__
method. IPython expands on this idea and allows objects to declare other, richer representations including:
from IPython.display import HTML
HTML('<iframe src=http://dlab.zhaw.ch width=800 height=350></iframe>')
from IPython.display import Image
Image('DataLab_final_logo__ColourURL_--UPDATED.png')
Store your Notebook in a git repository and point the NDViewer to it.
NDViewer http://nbviewer.ipython.org/
from datetime import timedelta
from IPython.display import YouTubeVideo
YouTubeVideo('F4rFuIb1Ie4', start=int(timedelta(hours=0, minutes=44, seconds=32).total_seconds()))