Lesson 309 of 2116
Jupyter Notebook Basics
Jupyter is the data scientist's notebook. Code, output, and narrative in one document. Learning Jupyter well pays dividends for every future project.
Lesson map
What this lesson covers
Learning path
The main moves in order
- 1A Living Document
- 2Jupyter
- 3notebook
- 4kernel
Concept cluster
Terms to connect while reading
Section 1
A Living Document
A Jupyter notebook is a browser-based editor where you mix code cells, markdown cells, and their outputs in one file. Run a cell, see the result right below, write an explanation, continue. It is the default tool for data science because it fits how exploration actually works.
The two main cell types
- Code cells: run Python (or R, Julia, etc.) and show output
- Markdown cells: formatted text with headings, links, LaTeX math
Getting started
Four ways to get a Jupyter environment
# Install
pip install jupyterlab pandas matplotlib
# Launch
jupyter lab
# Or use cloud versions
# - Google Colab (colab.research.google.com)
# - Kaggle Notebooks
# - Hugging Face Spaces with Jupyter
# - GitHub CodespacesThe kernel is the key concept
A kernel is the running Python (or other) process that executes your cells. Variables persist across cells because they live in the kernel. This is why the order you run cells matters more than the order they appear in the notebook.
Must-know shortcuts
- Shift+Enter: run cell, go to next
- Ctrl+Enter (Cmd+Enter Mac): run cell, stay here
- A: insert cell above, B: insert below (command mode)
- M: convert to markdown, Y: convert to code
- 00: restart the kernel
Magic commands
Jupyter magic commands
# Time a cell
%%time
expensive_function()
# Inline plots
%matplotlib inline
# Run shell commands
!pip install seaborn
!ls -lh data/
# Inspect a variable
?pd.read_csv # shows docstringCommon anti-patterns to avoid
- Giant cells with 200 lines of code (break them up)
- No markdown explaining the flow (readers drown)
- Leaving unused code in the middle of the notebook
- Hardcoding file paths that only work on your machine
- Not pinning library versions for reproducibility
The big idea: Jupyter is exploration married to narration. Treat your notebook as a story, not just a scratch pad, and your future self (and collaborators) will thank you.
End-of-lesson quiz
Check what stuck
15 questions · Score saves to your progress.
Tutor
Curious about “Jupyter Notebook Basics”?
Ask anything about this lesson. I’ll answer using just what you’re reading — short, friendly, grounded.
Progress saved locally in this browser. Sign in to sync across devices.
Related lessons
Keep going
Creators · 45 min
Running Your Own Small Experiment
The best way to truly understand an AI claim is to try it yourself. Here is how to run a small experiment that actually teaches you something.
Creators · 45 min
Open vs. Closed Models: Philosophy and Strategy
Open-source AI is both a technical movement and a political one. Understand the arguments so you can pick a stack and defend it.
Creators · 32 min
AP Biology: Using AI to Survive the Vocab Tsunami
AP Bio has roughly a thousand terms and four big concepts. NotebookLM and Claude Projects can turn your textbook into a custom tutor that actually knows what you are studying.
