Introduction To Jupyter Notebooks

(and why you should love them!)

Eshin Jolly

I Wanna Be Interactive

  • Interactive data analysis through code "cells"
  • Inline plotting
  • Access to the file system
  • "IDE" for analysts
In [10]:
#Put some code here!
x = 10
print x
10
In [25]:
#Put more code here!

Notebooks of the Future

Not just for code

  • Markdown, HTML, LateX integration
  • Slide shows (like this one!)
  • Keep your notes alongside your analysis routines
  • Embed images, videos, anything (it's all just HTML + javascript)

I'm Multilingual!

Not just for Python!

  • Python (multiple versions together!)
  • R
  • Matlab
  • Javascript
  • Julia
  • 30+ others

R... the master troll of statistical languages

In [3]:
%load_ext rpy2.ipython
In [4]:
%%R
cat("This is an R cell!\n")
seq(1,10,2)
This is an R cell!
[1] 1 3 5 7 9

Matlab... because you enjoy paying for licenses

In [ ]:
%load_ext pymatbridge
In [6]:
%%matlab
disp('This is a matlab cell')
repmat([1 2 3],2)
This is a matlab cell
ans =
     1     2     3     1     2     3
     1     2     3     1     2     3

But we can talk to each other

In [7]:
x = %R seq(1,10,2)
x *= 10
print("Look now I'm a numpy array!")
print(type(x))
Look now I'm a numpy array!
<type 'numpy.ndarray'>

Sharing is Caring

Save notebooks in other formats and put them online

Pimp My Ride

You can customize your notebook experience with extensions

But be careful of yak-shaving:

"Falling down an endless series of sub-tasks that prevent you from actually getting anything done"

Tips and Tricks

Lots of extra features

  • Interactive debugger (%pdb)
  • Timing code (%timeit)
  • Memory usage (%memit)
  • Profiling (%prun)
  • Development (%file, %reload)