Monaen's WikiJupyter Notebook 2017-03-17
Keyboard shortcuts
Magic keywords
%timeit: Magic command to time how long it takes for a single line function to run.%%timeit: Magic command to time how long it takes for a whole cell to run.%matplotlib inline: To render figures directly in the notebook, you should use the inline backend with the command.- Tip: On higher resolution screens such as Retina displays, the default images in notebooks can look blurry. Use
%config InlineBackend.figure_format = 'retina'after%matplotlib inlineto render higher resolution images. - To select a specific backend
- Tip: On higher resolution screens such as Retina displays, the default images in notebooks can look blurry. Use
Debug
%pdb: Magic command to set up debugging environment.- [pdb documentation](https://docs.python.org/3/library/pdb.html: Read more about
pdbin the pdb documentation. To quit the debugger, simply enterqin the prompt.
- [pdb documentation](https://docs.python.org/3/library/pdb.html: Read more about
Convert
Convert .ipynb to html
To convert a notebook to an HTML file, in your terminal use
1
jupyter nbconvert --to html notebook.ipynb
learn more about
nbconvertfrom the documentation.
Convert .ipynb to slides
To convert a notebook to slide file, in your terminal use
1
jupyter nbconvert notebook.ipynb --to slides
To convert it and immediately see it, use
1
jupyter nbconvert notebook.ipynb --to slides --post serve ## This will open up the slideshow in your browser so you can present it.