5 Jupyter Notebook Tricks I Only Discovered 2 Years Into My Data Science Career | by Matt Chapman | Jul, 2023


Custom keyboard shortcuts, highlighting text, and more

Image by Lukas Bato on Unsplash

Despite their popularity amongst users of R, Python and Julia, Jupyter Notebooks are rarely used to their full potential.

Most users know the basic commands (execute code, comment, save, etc.), but few make use of Jupyter’s hidden tricks — even though these can save significant time and effort.

Since 2019 (when I started using Jupyter), I’ve discovered lots of time-saving tricks and tips that most beginners are unaware of. In this article, I’ll show you 5 of my favourites:

  1. Keyboard shortcuts — “off-the-shelf” commands such as inserting/deleting/moving cells and text
  2. Custom keyboard shortcuts — add in your own advanced commands like moving cells up/down or restarting the kernel and running up to the current cell, right from the keyboard
  3. Markdown formatting — create tables, format text and create checkboxes
  4. HTML formatting — highlight text & make your comments stand out
  5. “Enable scrolling for outputs” — suppress lengthy cell results (this is a goldmine when tuning hyperparameters)

Keyboard shortcuts provide a nifty way to navigate around a Jupyter notebook and execute commands. Here are the main ones I use:

Run cells

  • Shift + Enter — run the current cell AND select the cell below
  • Ctrl/Cmd + Enter — run the current cell
  • Option/Alt + Enter — run the current cell and insert another cell below

Save progress

  • Ctrl/Cmd + s— save the notebook

Insert/delete cells

First, click inside a cell, and then make sure you’re in command mode by pressing Esc. If you don’t press Esc, you’ll be in edit mode and only able to perform actions on contents of a cell (rather than the cells themselves). Once you’re in command mode, the cursor in the cell will stop blinking. Then, press one of the following:



Source link

Leave a Comment