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 inline to render higher resolution images.
    • To select a specific backend

Debug

  • %pdb: Magic command to set up debugging environment.

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 nbconvert from 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.

Resources