A gallery of interesting IPython Notebooks - rhogendo/ipython GitHub Wiki
This page is a curated collection of IPython notebooks that are notable for some reason. Feel free to add new content here, but please try to only include links to notebooks that include interesting visual or technical content; this should not simply be a dump of a Google search on every ipynb file out there.
Important contribution instructions: If you add new content, please ensure that for any notebook you link to, the link is to the rendered version using nbviewer, rather than the raw file. Simply paste the notebook URL in the nbviewer box and copy the resulting URL of the rendered version. This will make it much easier for visitors to be able to immediately access the new content.
Note that Matt Davis has conveniently written a set of bookmarklets and extensions to make it a one-click affair to load a Notebook URL into your browser of choice, directly opening into nbviewer.
Table of Contents
- Introductory Tutorials
- Programming and Computer Science
- Statistics, Machine Learning and Data Science
- Physics, Chemistry, Biology
- Earth Science and Geo-Spatial data
- Linguistics and Text Mining
- Signal Processing
- General topics in scientific computing
- Social data
- Psychology and Neuroscience
- Machine Learning
- Physics, Chemistry and Biology
- Economics
- Earth science and geo-spatial data
- Data visualization and plotting
- Mathematics
- Signal and Sound Processing
- Natural Language Processing
- Pandas for data analysis
- General Python Programming
- Julia notebooks
- Haskell notebooks
- Ruby notebooks
- Miscellaneous topics about doing various things with the Notebook itself
- Reproducible academic publications
- Whimsical notebooks
- Videos of IPython being used in the wild
Entire books or other large collections of notebooks on a topic
Introductory Tutorials
-
First things first, how to run code in the IPython Notebook, this is one of IPython's official notebook example collection. Another useful one from this group, an explanation of our rich display system.
-
A great matplotlib tutorial, part of the fantastic Lectures on Scientific Computing with Python by J.R. Johansson.
-
The code of the IPython mini-book by C. Rossant, introducing IPython, NumPy, SciPy, Pandas and matplotlib for interactive computing and data visualization.
Programming and Computer Science
-
Introduction to Programming (using Python), an entire introductory Python course written by Eric Matthes. This post explains the educational context in an Alaskan high school where Eric is a teacher.
-
Python for Developers, a complete book on Python programming by Ricardo Duarte. Note the book also exists in Portuguese.
-
CS1001.py - Extended Introduction to Computer Science. Recitations from Tel-Aviv University introductory course to computer science, assembled as IPython notebooks by Yoav Ram.
Statistics, Machine Learning and Data Science
-
An introduction to Bayesian inference, this is just chapter 1 in an ongoing book titled Probabilistic Programming and Bayesian Methods for Hackers Using Python and PyMC, by Cameron Davidson-Pilon.
-
Learn Data Science, an entire self-directed course by Nitin Borwankar.
-
An introduction to machine learning with Python and scikit-learn (repo and overview) by Hannes Schulz and Andreas Mueller.
-
Neural Networks, part of a collection on machine learning by Aaron Masino.
-
An introduction to Pandas, part of an 11-lesson tutorial on Pandas, by Hernán Rojas.
-
Machine Learning with the Shogun Toolbox. This is a complete service that includes a ready-to-run IPython instance with a collection of notebooks illustrating the use of the Shogun Toolbox. Just log in and start running the examples.
-
Python for Data Analysis, an introductory collection from the CU Boulder Research Computing Group.
-
The Kaggle bulldozers competition example, one of a set on tutorials on exploratory data analysis with the copper toolkit by Daniel Rodríguez/
-
Understanding model reliability, part of a complete course on statistics and data analysis for psychologists by Michael Waskom.
-
Graphical Representations of Linear Models, an illustration of the Seaborn statistical visualization library, that also includes Visualizing distributions of data and Representing variability in timeseries plots. By Michael Waskom.
-
Desperately Seeking Silver, one of the homework sets for Harvard's CS 109 Data Science course.
Physics, Chemistry, Biology
-
A single-atom laser model. This is one of a complete set of lectures on quantum mechanics and quantum optics using QuTiP by J.R. Johansson.
-
2-d rigid-body transformations. This is part of Scientific Computing in Biomechanics and Motor Control, a complete collection of notebooks by Marcos Duarte.
-
Astrophysical simulations and analysis with yt: a collection of example notebooks on using various codes that yt interfaces with: Enzo, Gadget, RAMSES, PKDGrav and Gasoline. Note: the yt site currently throws an SSL warning, they seem to have an outdated or self-signed certificate.
-
Working with Reactions, part of a set of tutorials on cheminformatics and machine learning with the rdkit project, by Greg Landrum.
-
CFD Python: 12 steps to Navier-Stokes. A complete set of lectures on Computational Fluid Dynamics, from 1-d linear waves to full 2-d Navier-Stokes, by Lorena Barba.
Earth Science and Geo-Spatial data
-
EarthPy, a collection of IPython notebooks with a focus on Earth Sciences, from whale tracks to the flow of the Amazon.
-
Python for Geosciences, a tutorial series aimed at the Earth Sciences community, by Nikolay Koldunov.
-
Find graffitis close to NY subway entrances, one of a rich collection of notebooks on large-scale data analysis, by Roy Hyunjin Han.
-
Logistic models of well switching in Bangladesh, part of the "Will it Python" blog series (repo) on Machine Learning and data analysis in Python. By Carl Vogel.
Linguistics and Text Mining
-
Detecting Algorithmically Generated Domains, part of the Data Hacking collection on security-oriented data analysis with IPython & friends.
-
Mining the Social Web (2nd Edition). A complete collection of notebooks accompanying Matthew Russel's book by O'Reilly.
Signal Processing
-
Sound Analysis with the Fourier Transform. A set of IPython Notebooks by Caleb Madrigal to explain what the Fourier Transform is and how to use it for basic audio processing applications.
-
An introduction to Compressed Sensing, part of Python for Signal Processing: an entire book (and blog) on the subject by Jose Unpingco.
Scientific computing and data analysis with the SciPy Stack
General topics in scientific computing
-
A Crash Course in Python for Scientists, by Sandia's Rick Muller.
-
A gentle introduction to scientific programming in Python, biased towards biologists, by Mickey Atwal, Cold Spring Harbor Laboratory.
-
Python for Data Science, a self-contained mini-course with exercises, by Joe McCarthy.
-
First few lectures of the UW/Coursera course on Data Analysis. (Repo) by Chris Fonnesbeck.
-
CythonGSL: a Cython interface for the GNU Scientific Library (GSL) (Project repo, by Thomas Wiecki.
-
Using Numba to speed up numerical codes. And another Numba example: self-organizing maps.
-
Numpy performance tricks, and blog post, by Cyrille Rossant.
-
IPython Parallel Push/Execute/Pull Demo by Justin Riley.
-
Understanding the design of the R "formula" objects. By Matthew Brett.
-
Comparing different approaches to evolutionary simulations. Also available here to better visualization. The notebook was converted to a HTML presentation using an old nbconvert with the first developing implementation of
reveal
converter. By Yoav Ram. -
A git tutorial targeted at scientists by Fernando Perez.
Social data
-
Survival Analysis, an illustration of the lifelines library, by Cam Davidson Pilon.
-
A reconstruction of Nate Silver's 538 model for the 2012 US Presidential Election, by Skipper Seabold (complete repo).
-
Data about the Sandy Hook massacre in Newtown, Conneticut, which accompanies a more detailed blog post on the subject. Here are the notebook and accompanying data. By Brian Keegan.
-
Ranking NFL Teams. The full repo also includes an explanatory slideshow. By Sean Taylor.
-
Automated processing of news media and generation of associated imagery.
-
An analysis of national school standardized test data in Colombia using Pandas (in Spanish). By Javier Moreno.
-
Getting started with GDELT, by David Masad. GDELT is a dataset containing more than 200-million geolocated events with global coverage for 1979 to the present. Another GDELT example from David, that nicely integrates mapping visualizations.
-
Titanic passengers, coal mining disasters, and vessel speed changes, by Christopher Fonnesbeck
-
A geographic analysis of Indonesian conflicts in 2012 with GDELT, by herrfz.
-
Bioinformatic Approaches to the Computation of Poetic Meter, by A. Sean Pue, C. Titus Brown and Tracy Teal.
-
Analyzing the Vélib dataset from Paris, by Cyrille Rossant (Vélib is Paris' bicycle-sharing program).
-
Using Python to see how the Times writes about men and women, by Neal Caren.
-
Exploring graph properties of the Twitter stream with twython and NetworkX, by F. Perez (complete gist repo with utilities here.)
-
Kaggle Competition: Titanic Machine Learning from Disaster. By Andrew Conti.
-
How clean are San Francisco's restaurants?, a data science tutorial that accompanies a blog post from Zipfian Academy.
Psychology and Neuroscience
-
Modeling psychophysical data with non-linear functions by Ariel Rokem.
-
Visualizing mathematical models of brain cell connections. The effect of convolution of different receptive field functions and natural images is examined.
Machine Learning
-
An introduction to parallel machine learning with sklearn, joblib and IPython.parallel, a notebook that accompanies this slide deck by Olivier Grisel.
-
A tutorial introduction to machine learning with sklearn, an IPython-based slide deck by Andreas Mueller.
-
Face Recognition on a subset of the Labeled Faces in the Wild dataset, by Olivier Grisel.
-
An Introduction to Bayesian Methods for Multilevel Modeling, by Chris Fonnesbeck.
-
Implementing simple sequential feature selection algorithms in Python, by Sebastian Raschka.
-
A collection of examples for solving pattern classification problems, by Sebastian Raschka.
Physics, Chemistry and Biology
-
Multibody dynamics and control with Python and the notebook file by Jason K. Moore.
-
Manipulation and display of chemical structures, by Greg Landrum, using rdkit.
-
The sound of Hydrogen, visualizing and listening to the quantum-mechanical spectrum of Hydrogen. By Matthias Bussonnier.
-
Particle physics at the Large Hadron Collider (LHC): using ROOT in an LHCb masterclass: Notebook 1 and Notebook 2 notebooks by Alexander Mazurov and Andrey Ustyuzhanin at CERN.
-
A Reaction-Diffusion Equation Solver in Python with Numpy, a demonstration of how IPython notebooks can be used to discuss both the theory and implementation of numerical algorithms on one page, by Georg Walther.
-
Comparing different approaches to evolutionary simulations. Also available here to better visualization. The notebook was converted to a HTML presentation using an old nbconvert with the first developing implementation of
reveal
converter. By Yoav Ram.
Economics
- Replication of the highly-contentious analysis of economic growth by Reinhart and Rogoff, by Vincent Arel-Bundock, full repo here. This is based on the widely-publicized critique of the original analysis done by Herndon, Ash, and Pollin.
Earth science and geo-spatial data
-
Exploring seafloor habitats: geographic analysis using IPython Notebook with GRASS & R. This embeds a slideshow and a Web Spinning Globe (Cesium) in the notebook. By Massimo Di Stefano.
-
Geo-Spatial Data with IPython. Tutorial by Kelsey Jordahl from SciPy2013.
Data visualization and plotting
-
A Plotly Notebook with an interactive Hans Rosling Gapminder bubble chart, NumPy boxes, and a datetime decay graph.
-
Data and visualization integration via web based resources. Using NetCDF, Matplotlib, IPython Parallel and ffmpeg to generate video animation from time series of gridded data. By Massimo Di Stefano.
-
Converting matplotlib figures into interactive, D3 graphs, with matplotlylib.
-
Visualizing complex-valued functions with Matplotlib and Mayavi, by Emilia Petrisor.
-
A D3 Viewer for Matplotlib Visualizations, different from above by not depending on Plot.ly account.
Mathematics
-
Linear algebra with Cython. A tutorial that styles the notebook differently to show that you can produce high-quality typography online with the Notebook. By Carl Vogel.
-
Exploring how smooth-looking functions can have very surprising derivatives even at low orders, combining SymPy and matplotlib. By Javier Moreno.
-
A Collection of Applied Mathematics and Machine Learning Tutorials (in Turkish). By Burak Bayramli.
-
Function minimization with iminuit, an introductory companion to their hard core tutorial. By the iminuit project.
-
The Discrete Cosine Transform, a brief explanation and illustration of the math behind the DCT and its role in the JPEG image format, by Jim Mahoney.
-
Chebfun in Python, a demo of PyChebfun, by Olivier Verdier. PyChebfun is a pure-python implementation of the celebrated Chebfun package by Battles and Trefethen.
Signal and Sound Processing
-
Simulation of Delta Sigma modulators in Python with deltasigma, Python port of of Richard Schreier's excellent MATLAB Delta Sigma Toolbox by Giuseppe Venturini. Collection of demonstrative notebooks on the package README.
-
PyOracle: Automatic analysis of musical structure, by Greg Surges.
Natural Language Processing
- Python Programming for the Humanities by Folgert Karsdorp & Maarten van Gompel.
Pandas for data analysis
Note that in the 'collections' section above there are also pandas-related links, such as the one for an 11-lesson tutorial.
-
A 10-minute whirlwind tour of pandas, this is the notebook accompanying a video presentation by Wes McKinney, author of Pandas and the Python for Data Analysis book.
-
Clustering of smartphone sensor data for human activity detection using pandas and scipy, part of Coursera data analysis course, done in Python (repo).
-
Log analysis with Pandas, part of a group presented at PyConCa 2012 by Taavi Burns.
-
Analyzing and visualizing sun spot data with Pandas, by Josh Hemann. An enlightening discussion of how naive plotting choices subtly influence our interpretation of data.
General Python Programming
-
Learning to code with Python, part of an introduction to Python from the Waterloo Python users group.
-
Python Descriptors Demystified, an in-depth discussion of the descriptor protocol in Python, by Chris Beaumont.
-
Looking at Python's True and False evaluations, by Sebastian Raschka.
-
Short performance comparison of
.format()
and the binary%
operator for string formatting, by Sebastian Raschka.
Julia notebooks
The IPython protocols to communicate between kernels and clients are language agnostic, and other programming language communities have started to build support for this protocol in their language. The Julia team has created IJulia, and these are some Julia notebooks:
-
The Design Impact of Multiple Dispatch, a detailed explanation of Julia's multiple dispatch design, by Stefan Karpinski.
-
A tutorial on making interactive graphs with Plotly and Julia.
Haskell notebooks
There exists a Haskell kernel for IPython in the IHaskell project.
- IHaskell Demo Notebook
- Homophone reduction, a solution to a cute problem involving treating English letters as generators of a large group.
- Gradient descent typeclass, a look at how arbitrary gradient descent algorithms can be represented with a typeclass.
Ruby notebooks
Similar to the Julia kernel there exists also a Ruby kernel for IPython.
Miscellaneous topics about doing various things with the Notebook itself
-
Blogging With IPython in Blogger, also available in blog post form, full repo here. By Fernando Perez.
-
Blogging With IPython in Octopress, by Jake van der Plas and available as a blog post. Other notebooks by Jake contain many more great examples of doing interesting work with the scientific Python stack.
-
Blogging With IPython in Nikola, also available in blog post form by Damián Avila.
-
Custom CSS control of the notebook, this is part of a blog repo by Matthias Bussonnier.
-
IPython display hookery: tools to help display visual output from various sources, a gist by @deeplook.
Reproducible academic publications
This section contains academic papers that have been published in the peer-reviewed literature or pre-print sites such as the ArXiv that include one or more notebooks that enable (even if only partially) readers to reproduce the results of the publication. If you include a publication here, please link to the journal article as well as providing the nbviewer notebook link (and any other relevant resources associated with the paper).
-
powerlaw: a Python package for analysis of heavy-tailed distributions, by J. Alstott et al.. Notebook of examples in manuscript, ArXiv link and project repository.
-
Collaborative cloud-enabled tools allow rapid, reproducible biological insights, by B. Ragan-Kelley et al.. The main notebook, the full collection of related notebooks and the companion site with the Amazon AMI information for reproducing the full paper.
-
A Reference-Free Algorithm for Computational Normalization of Shotgun Sequencing Data, by C.T. Brown et al.. Full notebook, ArXiv link and project repository.
-
The kinematics of the Local Group in a cosmological context by J.E. Forero-Romero et al.. The Full notebook and also all the data in a github repo.
-
Warming Ocean Threatens Sea Life, an article in Scientific American backed by a notebook for its main plot. By Roberto de Almeida from MarinExplore.
-
Extrapolating Weak Selection in Evolutionary Games, by Wu, García, Hauert and Traulsen. PLOS Comp Bio paper and Figshare link.
-
[Using neural networks to estimate redshift distributions. An application to CFHTLenS] (http://nbviewer.ipython.org/urls/bitbucket.org/christopher_bonnett/nn_notebook/raw/5e69b55193a229cb2076a2f18e43b45c56e317e0/T-800.ipynb) by Christopher Bonnett paper(submitted to MNRAS)
-
Mechanisms for stable, robust, and adaptive development of orientation maps in the primary visual cortex by Jean-Luc R. Stevens, Judith S. Law, Jan Antolik, and James A. Bednar. Journal of Neuroscience, 33:15747-15766, 2013. Notebook1, Notebook2.
Whimsical notebooks
-
XKCD-styled plots created with Matplotlib. Here is the blog post version with discussion. By Jake van der Plas.
-
Van Gogh's Starry Night with ipythonblocks, part of Matt Davis' ipythonblocks. This is a teaching tool for use with the IPython notebook that provides visual elements to understand programming concepts.
-
Conway's Game of Life. Interesting use of convolution operation to calculate the next state of game board, instead of obvious find neighbors and filter the board for next state.
-
"People plots", stick figures generated with matplotlib.
-
Reveal converter mini-tutorial, also available in blog post form. Do you want to make static html/css slideshow straight from the IPython notebook? OK, now you can do it with the reveal converter (nbconvert). Demo by Damián Avila.
-
[Personal IPython Weight Notebook] (http://nbviewer.ipython.org/gist/9769238). Plot your loss of weight with prognosis and motivation features.
Videos of IPython being used in the wild
Of course the first thing you might try is searching for videos about IPython (1900 or so by last count on Youtube) but there are demonstrations of other applications using the power of IPython but are not mentioned is the descriptions. Below are a few such:
-
Video on how to learn Python featuring IPython as the platform of choice for learning!
-
This video shows IPython being used in the scikit-learn project
-
He doesn't show IPython in use but his IPython sticker is clear for the entire video: Planning and Tending the Garden: The Future of Early Childhood Python Education
-
Wes McKinney's speech on Python and data analysis features IPython as does his book Python for Data Analysis
-
This video shows Plotly and IPython in use at a Montreal Python meetup.