7 Essential Jupyter Notebook Tips for Data Analysis: Profiling, Interactive Visualisation, Magic Commands, Formatting, Shortcuts, Multiple Outputs, and Slide Creation
This article presents seven practical techniques for enhancing daily data‑analysis work in Jupyter notebooks, covering Pandas Profiling, Cufflinks/Plotly visualisation, IPython magic commands, markdown formatting, keyboard shortcuts, displaying multiple outputs simultaneously, and converting notebooks into live presentation slides.
This guide lists seven useful tricks to boost everyday data‑analysis tasks in Jupyter notebooks.
1. Pandas Profiling
Install the pandas-profiling package and call df.profile_report() to generate an extensive exploratory report with a single line of code. The report includes statistics, correlations, missing values, and interactive visualisations. For more details see the original article on Towards Data Science.
2. Using Cufflinks and Plotly to Plot Pandas Data
Experienced data scientists often rely on matplotlib and pandas . By installing cufflinks (which wraps Plotly) you can create interactive, zoomable charts with a simple .iplot() call. Install it via pip install cufflinks --upgrade and explore the richer visualisation options, such as .scatter_matrix() .
3. IPython Magic Commands
IPython provides line magics (prefixed with % ) and cell magics (prefixed with %% ). Useful examples include:
%lsmagic – list all available magic commands.
%debug – start an interactive debugger after an exception.
%store – save variables to be reused in other notebooks.
%who – display all global variables.
%%time – measure execution time of a cell.
%%writefile filename.py – write the cell contents to a file.
4. Formatting in Jupyter
Jupyter notebooks support HTML/CSS inside markdown cells. Common patterns include coloured alert boxes using Bootstrap classes:
<code><div class="alert alert-block alert-info">This is <b>fancy</b>!</div></code> <code><div class="alert alert-block alert-danger">This is <b>baaaaad</b>!</div></code> <code><div class="alert alert-block alert-success">This is <b>gooood</b>!</div></code>5. Jupyter Keyboard Shortcuts
In command mode (press Esc ) you can navigate and edit cells:
A / B – insert a new cell above or below.
M – change cell to markdown.
Y – change cell to code.
D,D – delete the current cell.
Enter – switch to edit mode.
In edit mode you have additional shortcuts:
Shift+Tab – show the docstring of the object under the cursor.
Ctrl+Shift+- – split the cell at the cursor.
Esc+F – find and replace in the notebook.
Esc+O – toggle cell output.
Shift+Down/Up – select multiple cells.
Shift+M – merge selected cells.
6. Displaying Multiple Outputs in One Cell
To show several results (e.g., .head() and .tail() ) without creating separate cells, set the interactivity mode to "all":
<code>from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"</code>Now every expression in the cell is rendered.
7. Turning a Notebook into Live Slides with RISE
Install RISE via conda install -c conda-forge rise or pip install RISE . After installation a new button appears in the toolbar; clicking it converts the notebook into an interactive slideshow while keeping the kernel active.
Overall, these tips help data scientists work more efficiently, produce richer visualisations, and present their findings directly from Jupyter notebooks.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.