Karlijn Willems Jupyter Notebook Cheat Sheet September 19th, 2017 This Jupyter Notebook cheat sheet will help you to find your way around the well-known Jupyter Notebook. Jupyter Notebook is a web-based interface that helps you to build and exchange documents containing live code, visualizations, informative text, and equations. Also, Jupyter Notebook includes statistical modeling, numerical simulation, machine learning, data cleaning, and transformation. In this cheat sheet you will learn the following techniques.
IPython / Jupyter¶
- Using IPython makes interactive work easy.
- Better shell
- Notebook interface
- Embeddable kernel
- Parallel python
IPython shell shortcuts¶
- TAB expansion to complete python names and file paths
- ~ and * directory / file expansion
- many 'magic' methods:
Help¶
%pdoc
%pdef
%psource
for docstring, function definition, source code only.
Run¶
To run a program directly from the IPython console:
%run
has special flags for timing the execution of your scripts (-t
) or for running them under the control of either Python's pdb debugger (-d
) or profiler (-p
):
Other Commands¶
%reset
is not a kernel restart- Restart with
Ctrl+.
in 'qtconsole' import module ; reload(module)
to reload a module from disk
Debugging¶
OS Commands¶
History¶
GUI integration¶
Start with ipython --gui=qt
or at the IPython prompt:
Arguments can be wx
, qt
, gtk
and tk
.
Matplotlib / pylab graphics in an iPython shell¶
Jupyter Notebook Cheat Sheet
Start with: ipython --matplotlib
( or --matplotlib=qt
etc..)
At the IPython prompt:
%pylab
makes the following imports:
At the command prompt:
alternative: --matplotlib inlineor within IPython:
To embed plots, SVG or HTML in qtconsole, call display:
IPython Notebook web-based interface¶
- Start with: ipython notebook and switch to browser
- Keyboard shortcuts:
Enter
to edit a cellShift + Enter
to evaluateCtrl + m
orEsc
for the 'command mode'
In command mode:
Jupyter Notebook Markdown Cheat Sheet
Systemuiserver for mac. Papermill is a tool for parameterizing and executing Jupyter Notebooks.