Skip to the workspace
Pebellslearn by building
Setting Up Your Data Toolkit  ›  Capstone Project

Notebooks: JupyterLab, Colab and VS Code

JupyterLab 12 minA notebook sends cells to a kernel that keeps variables in memory, so results depend on the order cells were run rather than the order they appear.

python data analysis / Notebooks: JupyterLab, Colab and VS Code

Explore each scene at your own pace.

01 · The rule

The rule

Notebooks: JupyterLab, Colab and VS Code

Data analysis is a conversation with your data: load it, look, ask a question, look again. Running a whole script from the top for every small question is slow. A notebook lets you run one piece at a time and keeps the results on screen next to the code that made them.

The rule

A notebook remembers what you ran, in the order you ran it — not the order shown.

A notebook is a page of cells. A code cell holds Python; a markdown cell holds notes. Behind the page sits a kernel, a running Python process that keeps every variable alive between cells.

# Cell 1
import pandas as pd
sales = pd.read_csv("sales.csv")

# Cell 2
sales.head()      # the last line of a cell is displayed automatically

Run Cell 1 once, then run Cell 2 as many times as you like. sales stays in memory, so you never reload the file just to look again.

Three common places to run notebooks:

  • JupyterLab: runs on your own machine, opened in the browser. Uses the packages in whichever environment you start it from.
  • Google Colab: a hosted notebook in the browser. Nothing to install, pandas and NumPy come ready, and files live in the cloud session, which resets after a while.
  • VS Code: opens .ipynb files inside the editor. You pick the kernel (for example your project's .venv) from a menu.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.