Start studying
Module 6 · Data Wrangling Module contents
Module 6  ·  Card 3 / 14beginner

Jupyter Notebooks

A Jupyter notebook is a document that mixes runnable code, its output and written notes.

The code sits in cells, and running a cell shows its result straight underneath.

For example, one cell loads a sales file, the next draws a chart, and a text cell explains what the chart shows.

Variables stay in memory between cells, so you can explore step by step without starting over.

Cells can be run in any order, so a notebook can show results that a fresh run from the top would not reproduce.

Learn in depth ↓
Module 06 · Data Wrangling · 14 concepts
In depth  /  15 lines

Jupyter Notebooks, in more detail

Notebooks exist because data work is exploratory: you look, adjust and look again.

A script runs from top to bottom in one go, while a notebook lets you stop and inspect after every step.

The name comes from Julia, Python and R, the three languages the project first aimed at.

Behind each notebook runs a kernel, the process that executes the code and holds the variables.

Running a cell sends its code to the kernel, and the result comes back into the page.

Text cells use simple formatting, so explanations and headings sit next to the code they describe.

The notebook file saves the code, the text and the latest outputs together.

That makes it easy to share an analysis with its charts included, without the reader running anything.

The kernel's memory is not saved, so reopening a notebook shows old outputs but no live variables.

Hidden state is the main danger, because a cell edited or deleted after running can leave results nobody can recreate.

Restarting the kernel and running every cell from the top is the standard check before sharing.

Notebooks are awkward to compare line by line between versions, because outputs change on every run.

Analysts usually explore in a notebook, then move code that must run on a schedule into plain scripts.

They are widely used for teaching, because each step and its output can be read in order.

A notebook is less a program than a lab record of what was tried, and it should be read that way.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
A colleague's notebook shows a correct chart, but when you restart it and run every cell from the top, it fails. What is the most likely cause?
Data Wrangling

14 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close