Jupyter Notebooks and Reproducible Work

Using notebooks to explore data interactively while keeping analyses organised, rerunnable and shareable.

Beginner · about 3 hours · difficulty 1/5

Learn first: Python for Analysts

Notebooks mix code, output, charts and text in one document. They are ideal for exploration and for sharing analyses with other technical people.

Using Jupyter well

  • Run in JupyterLab, VS Code, or hosted options like Google Colab and Kaggle Notebooks (free, no install).
  • Use Markdown cells for headings and explanations; a notebook should read like a short report.
  • Learn keyboard shortcuts: Shift+Enter to run, A/B to add cells, M for Markdown.
  • Display DataFrames and charts inline for quick feedback.

Reproducibility habits

  • Restart and Run All before sharing. Cells run out of order are the number one notebook bug: the output you see may depend on state that no longer exists.
  • Put imports and configuration at the top; keep paths relative.
  • Record package versions in a requirements.txt.
  • Move reusable functions into a .py file and import them.
  • Keep raw data read-only; write cleaned outputs to a separate folder.

Project layout

A simple structure goes a long way: data/raw, data/processed, notebooks/, src/, reports/. Number notebooks in order (01-clean.ipynb, 02-eda.ipynb).

Pitfall: one 300-cell notebook that nobody, including future you, can follow. Move on when a colleague can clone your folder, install requirements, and rerun your notebook top to bottom to get the same results.

Key concepts

  • JupyterLab and VS Code notebooks
  • Google Colab and Kaggle Notebooks
  • Markdown cells
  • Restart and Run All
  • requirements.txt
  • Project folder structure

Mini project

Turn your earlier Python script into a documented notebook with headings, explanations and inline charts, then confirm it runs cleanly after Restart and Run All.

Check yourself

Why can a notebook show correct results yet fail when someone else runs it from the top?

Free resources