Fundamentals 6 min read

10 Little‑Known Jupyter Tricks That Can Double Your Productivity

This article walks through ten hidden Jupyter Notebook features—including magic commands, terminal integration, shortcut keys, markdown styling, collapsible headings, nbconvert exporting, and tab completion—showing how each can streamline debugging, documentation, and reporting to save roughly an hour of work per day.

Data STUDIO
Data STUDIO
Data STUDIO
10 Little‑Known Jupyter Tricks That Can Double Your Productivity

Variable locator: %who & %whos

List variables in the current namespace and display their type, size, and value.

import numpy as np

data = np.array([1, 2, 3])
%whos  # output: data  numpy.ndarray  (3,)  [1 2 3]

Speed judge: %timeit

Compare execution speed of code snippets. The magic command runs the expression repeatedly and reports the average time.

%timeit [i**2 for i in range(1000)]
%timeit np.square(np.arange(1000))

Using %%timeit (double percent) measures the whole cell.

Terminal connector: ! command

!ls
!pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple
!cat data.csv

Code exporter: %%writefile

%%writefile my_utils.py

def clean_data(df):
    return df.dropna().reset_index(drop=True)

Verify the export:

!cat my_utils.py

Syntax dictionary: ? & ??

len?
pd.DataFrame??

Shortcut keys "triple kill"

Shift + Enter – run cell and move to the next cell.

Ctrl + Enter – run cell and stay in place.

Alt + Enter – run cell and insert a new cell below.

Markdown beautifier

# Heading 1 (Report Title)
## Heading 2 (Section Title)
- 1. Data cleaning
- 2. Model training
$y = wx + b$  # linear regression formula
![Description](image_link)

Large‑note collapser

Installation for Jupyter Notebook

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

Restart Jupyter and enable "Collapsible Headings" in the Nbextensions panel.

Installation for Jupyter Lab (≥3.0)

Search for "Collapsible Headings" in the Extension Manager and install.

Toggle collapse by clicking the triangle next to a heading or pressing T in command mode.

Export purifier: nbconvert + tags

Tagging

remove_input

– hide code, keep output. remove_output – hide output, keep code. remove_cell – delete the entire cell.

Export commands

# Export HTML without code cells
jupyter nbconvert --to html --TagRemovePreprocessor.remove_input_tags="{'remove_input'}" notebook.ipynb

# Export PDF (requires LaTeX)
jupyter nbconvert --to pdf --TagRemovePreprocessor.remove_cell_tags="{'remove_cell'}" notebook.ipynb

Smart prompt: Tab key

Auto‑complete variable and function names.

Show all methods of an object (e.g., df. + Tab).

Press Shift+Tab to display the function’s docstring in a tooltip.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Pythondata analysisproductivityJupyterMagic CommandsNotebook Tips
Data STUDIO
Written by

Data STUDIO

Click to receive the "Python Study Handbook"; reply "benefit" in the chat to get it. Data STUDIO focuses on original data science articles, centered on Python, covering machine learning, data analysis, visualization, MySQL and other practical knowledge and project case studies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.