Jupyter Notebook Tricks

Usage and Shortcuts

Useful Jupyter Notebook Shortcuts and Tips

View Python Function Documentation

Press Shift + Tab inside the parentheses of a function to view its docstring and signature.

Execute the Current Cell

  • Shift + Enter: Run the current cell and select the next cell
  • Ctrl + Enter: Run the current cell and stay
  • Alt + Enter: Run the current cell and insert a new cell below

Plot Graphs Inline

import matplotlib.pyplot as plt
%matplotlib inline

Execute Shell Commands

Prefix with ! to run shell commands directly from a cell:

!pip install gensim

Additional Tips

  • Autocomplete: Press Tab to autocomplete variable and function names.
  • Interrupt Execution: Press the stop button or use Kernel > Interrupt.
  • Restart Kernel: Use Kernel > Restart to reset the Python environment.
  • Markdown Cells: Use Markdown for formatted text, headers, lists, and code blocks.
  • Magic Commands: Use %timeit, %lsmagic, %who, etc., for enhanced functionality.

References