Conducting reproducible data analysis, visualization and computing experiments
How do you currently:
Python is a general-purpose programming language that blends procedural, functional, and object-oriented paradigms
Mark Lutz, Learning Python
http://blog.fperez.org/2012/01/ipython-notebook-historical.html
Interactive web-based computing, data analysis, and documentation.
Great for iterative programming.
2 type of cells:
Markdown for documentationMarkdown can contain LaTeX for equationsCode for execution programsHere is a formula:
$f(x,y) = x^2 + e^x$
In [1]:
2+4
Out[1]:
In [2]:
print("hello")
In [3]:
a=2
print("Hello world!")
In [4]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
x = np.random.randn(10000)
print(x)
In [5]:
plt.hist(x, bins=50)
plt.show()
In [6]:
%lsmagic
Out[6]:
In [7]:
%timeit y = np.random.randn(100000)
In [8]:
%ls
In [9]:
%%bash
ls -l
In [10]:
files = !ls # But glob is a better way
print files[:5]
In [11]:
%%writefile example.cpp
#include <iostream>
int main(){
std::cout << "hello from c++" << std::endl;
}
In [12]:
%ls example.cpp
In [13]:
%%bash
g++ example.cpp -o example
./example
In [14]:
!ipython nbconvert --to 'PDF' 01_introduction-IPython-notebook.ipynb
In [15]:
!open 01_introduction-IPython-notebook.pdf
In [16]:
!ipython nbconvert --to 'html' 01_introduction-IPython-notebook.ipynb