iPython - Day One with Project Jupyter


I recently came across a fun tool that is very helpful for learning Python, at least it has helped me a great deal.

Formerly known as iPython, the web-notebook is now known as Project Jupyter.

Project Jupyter

In more traditional uses of Jupyter, scientists graph and plot data using matplotlib and numpy.

Some basic examples from my day playing with the notebook.

In [ ]:

import time  
import sys  
for i in range(1, 6):  

Out [ ]: (time-sensitive output)

In [ ]: a nice list comprehension

[x**2 for x in range(1, 6)]

Out [ ]:
[1, 4, 9, 16, 25]

In [ ]: (playing with pi)

from math import pi  
[str(round(pi, i)) for i in range(1, 6)]

Out [ ]:
['3.1', '3.14', '3.142', '3.1416', '3.14159']

edit: from cool stuff to do with iPython!
In [ ]:

from numpy import *  
from matplotlib.pyplot import *

x  linspace(-1, 1, 100)  
y = (-3*x**4 + 6*x**2)  

Out [ ]:

<matplotlib.figure.Figure at 0x7777be0>  

I also just learned about Beaker.

Another very cool Data Scientist's Lab Notebook. Beaker has many dependencies and requires you to install additional languages. I suggest downloading the Electron version. Beaker supports dozens of languages, including Scala, R, C, Ruby, Python, Go and many, many more. Check them out.

edit: I am now using Anaconda as my default Python interpreter when using Jupyter. It includes all of the modules required to do some advanced math or plotting, scientific equations, etc.

Craig Derington

Secular Humanist, Libertarian, FOSS Evangelist building Cloud Apps developed on Red Hat Enterprise Linux and Ubuntu Server. My toolset includes Python, Celery, Flask, Django, MySQL, MongoDB and Git.

comments powered by Disqus