Jupyter Notebooks are a brilliant way to develop code in a browser. In each notebook, there are cells and there are different kinds of cells; there are text cells, math cells and code cells. You can include code, documentation, data visualization, math, images, etc. all in one place. Notebooks are just big JSON files with the extension .ipynb.
Typically you’ll be running the server on your own machine where all your data and notebook files are stored. But, you could also set up a server on a remote machine or cloud instance like Amazon’s EC2. Then, you can access the notebooks in your browser from anywhere in the world.
Start a notebook
If you haven’t installed Jupyter using Anaconda, Jupyter notebooks are also available through pip.
pip install jupyter notebook
Launching the notebook server on your machine.
jupyter notebook
Now you can connect to the server through http://localhost:8888
You can shutdown the entire server by pressing Ctrl + C twice in the terminal.
Using notebooks
The following are the shortcuts you’ll be using most during developing code on notebooks.
Edit Enter
Cancel edit Escape
Run Ctrl + Enter
Run & move next Shift + Enter
Auto-complete Tab
Tooltips Shift + Tab
Documentation Shift + Tab x2
Help with shortcuts H
Create cell above A
Create cell below B
Delete cell D x2
Save Notebook S
Switch cell to code Y
Switch to markdown M
Line numbers L
Command Palette Shift+ Ctrl + P
Math expressions
Start and end an equation with a dollar sign:
$y = mx + b$
or double dollar signs for math blocks:
$$ y = \frac{a}{b+c} $$
Magic keywords
Magic commands are preceded with one or two percent signs (% or %%) for line magics and cell magics, respectively.
%matplotlib Set up matplotlib to work interactively in the notebook
%timeit func(20) Time how long it takes for a function to run
%%timeit Time how long it takes for a whole cell to run
%pdb Debugging in the Notebook
To learn more, here’s the list of all of the magic commands.
http://ipython.readthedocs.io/en/stable/interactive/magics.html
Converting notebooks
Jupyter comes with a utility called nbconvert for converting to HTML, Markdown, slideshows, etc
To HTML
jupyter nbconvert --to html notebook.ipynb
To Slideshows
jupyter nbconvert notebook.ipynb --to slides