Skip to content

Instantly share code, notes, and snippets.

@dusenberrymw
Last active June 20, 2017 19:10
Show Gist options
  • Save dusenberrymw/b23d41649a896446c06e855f6a56caa4 to your computer and use it in GitHub Desktop.
Save dusenberrymw/b23d41649a896446c06e855f6a56caa4 to your computer and use it in GitHub Desktop.
Tips & Tricks for Jupyter

Jupyter Tips & Tricks

Show available kernels:

  • jupyter kernelspec list

Install new custom kernel (such as PySpark):

  1. Install dummy kernel in home directory:
  • ipython kernel install --prefix ~/my_custom_jupyter_kernels
  1. Edit name of ~/my_custom_jupyter_kernels/share/jupyter/kernels/python3 folder as desired.
  2. Edit ~/my_custom_jupyter_kernels/share/jupyter/kernels/FOLDER_NAME/kernel.json as desired.
  3. Install for current user with jupyter kernelspec install --user ~/my_custom_jupyter_kernels/share/jupyter/kernels/FOLDER_NAME.

Performance testing:

  • The %%timeit magic allows for quick performance testing of a given cell.

Convert notebook to .py script:

  • jupyter nbconvert --to script NOTEBOOK_NAME.ipynb

Install Vim mode via jupyter-vim-binding:

# Create required directory in case (optional)
mkdir -p $(jupyter --data-dir)/nbextensions
# Clone the repository
cd $(jupyter --data-dir)/nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
# Activate the extension
jupyter nbextension enable vim_binding/vim_binding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment