Intro to Jupyter Notebooks

Vicky Steeves and Nicholas Wolf

Jupyter Notebooks Overview

Web Application
  • In-browser editing for code with auto-syntax highlighting, indentation, tab completion/introspection
  • In-browser code execution, with results attached to the code that generated them
  • Easily include math markdown using LaTeX
  • Display results of computation in rich media (LaTeX, HTML, SVG, etc.)

Jupyter Notebooks Overview

  • A complete computation record of a session, interleaving executable code with text, maths, and rich representations of objects
  • Can export to LaTeX, PDF, slideshows, etc. or available from a public URL that renders it as a static webpage



Download this file and save it in a directory where you can find it.

Jupyter Notebook Cheatsheet

Launch Notebook in a Directory Other than Home:
jupyter notebook --notebook-dir=PATH-TO-FOLDER

Code Cells:
  • Notebook will evaluate final statement in cell
  • Use shift + enter to run an active cell
  • Use esc in highlighted cell to toggle command options:
    • esc + L = show line numbers
    • esc + M = format cell as Markdown cell
    • esc + a = insert cell above current cell
    • esc + b = insert cell below current cell
  • Check all current variables: run %whos

Jupyter Notebook Cheatsheet

Tidy Display of Pandas Dataframes and Inline Images:

from IPython.display import Image as IM
from IPython.display import display

(Other types: file links, audio files, code, and more. See here)

Creating and Displaying Interactive Plots:

import matplotlib.pyplot as plt
%matplotlib inline

Jupyter Notebook Cheatsheet

Using IPython Display:


Make a Basic Scatter Plot:

x = list of values
y = list of values
plt.scatter(x, y) plt.xlabel('X Axis') plt.xlabel('Y Axis')

Jupyter Notebook Cheatsheet

Markdown Cells:

Moving a Notebook to the Web

Using NBViewer:

  1. Put notebook (.ipynb) file on the web (e.g. Github, Gitlab...somewhere so that URL is http://NAME-OF-NOTEBOOK.ipynb
  2. Enter the URL into NBViewer.
  3. Click Go! (check out example here)

Moving a Notebook to the Web

Using NBConvert:

  1. In directory of your notebook, enter:
    jupyter nbconvert --output-dir='./docs' --to html *.ipynb
  2. This gives you a directory called “docs” which has HTML files. If you put these files on GitHub or GitLab, you can render them as webpages.

More on Jupyter Notebooks

Excellent Tutorial by Justin Bois at Caltech: Documentation for Jupyter Notebooks:


Email us: &

Learn more about RDM:

Get this presentation:

Make an appointment: