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 automaticallyRun 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
.ipynbfiles inside the editor. You pick the kernel (for example your project's.venv) from a menu.