Unit 1.1 · about 5 h
1 / 324Notebook workflow, Python essentials and reproducible runs
The first objective is to become productive with data, not to master interpreter internals before doing useful work. A notebook is a working laboratory only when its state can be recreated from a clean start.
- implement
- explain
You can now
- Create a small notebook project with a clear data, notebook and output layout.
- Use variables, functions, conditionals, loops, lists, dictionaries, imports and basic file paths to inspect a dataset.
- Restart a notebook runtime and run every cell from top to bottom without relying on hidden state.
- Record the dataset source, package versions and any random seed that affects the result.
Covers
- Notebook workflows and reproducible experiments
- Python essentials for data work
Study, in this order
3 steps
- PythonKaggle Learn — Python
Complete lessons 1–7: syntax, functions, conditionals, lists, loops, strings/dictionaries and external libraries.
- Google Colab FAQGoogle Colab FAQ — free resources and limits
Use a hosted notebook for setup-light practice. Read the free-resource limitations; no GPU availability is guaranteed.
- The Python TutorialThe Python Tutorial
Use as a reference for control flow, data structures, modules, files and exceptions; it assumes some prior programming experience.
Focus on
- Python values, variables and expressions
- Functions, conditionals, loops, lists and dictionaries
- Imports and reading a CSV file
- Notebook kernel state, restart-and-run-all and reproducible outputs
Reproduce closed-book
Traps
- Do not treat notebook cell order as execution order; hidden state can make a broken notebook appear to work.
- Do not assume a free hosted notebook provides a stable GPU or unlimited runtime.
- Do not install packages repeatedly inside individual cells; keep setup in one documented place.
Practice
Redo the list, loop, dictionary and external-library exercises without copying the worked solution.
Keep the practice small; the target is fluency with data-handling syntax, not advanced Python internals.
Use a CPU notebook for this section. A GPU is not needed for CSV inspection, NumPy or pandas work.
Self-test
-
Why should you restart the kernel and run all notebook cells before treating the result as reproducible?
It tests whether the notebook depends on hidden interactive state, stale variables or cells executed out of order. -
What is the difference between a Python list and a function?
A list stores an ordered collection of values; a function packages reusable behavior that can receive inputs and return a result.
Completion criterion
Stop when
You can open a fresh notebook, read a CSV, write and call a helper function, inspect a few rows and reproduce the same result after restarting the runtime.
Mark passed, then open 1.2 Only mark this when you can do it without notes.Leads to
- 1.2 NumPy arrays: shape, dtype and vectorized operations Follow the practical starter sequence; each unit uses the artifact from the previous step.
Resources for this unit
- Kaggle Learn — Python Complete the course lessons on variables, functions, conditionals, lists, loops, strings, dictionaries and external libraries. Treat it as the practical Python vocabulary needed for the next units.
- The Python Tutorial Use as a reference for control flow, data structures, modules, files and exceptions. It assumes some prior programming experience; use Kaggle Learn for the first pass if the syntax is new.
- Google Colab FAQ — free resources and limits Use a hosted notebook for the first exercises if local setup is a distraction. The free tier has variable, non-guaranteed compute and GPU access; keep every exercise small enough to run on CPU.
Also in this section
- NumPy Quickstart Tutorial Study array creation, shape, indexing, universal functions, broadcasting and basic operations. Write down shapes and dtypes before changing an array.
- Kaggle Learn — Pandas Complete the short exercises on reading data, selecting, summary functions, grouping, sorting, data types, missing values and combining tables.
- pandas Getting Started Tutorials Use the official tutorials as a reference for reading and writing tables, selecting rows and columns, creating columns, summary statistics, joins and time-series handling.
- Matplotlib Quick Start Guide Use the Figure/Axes workflow to make labeled line plots, histograms and scatter plots. Keep plots diagnostic rather than decorative.
- Bike Sharing Dataset Use the hourly
hour.csvdata for the two linked starter projects. Cite Fanaee-T (2013), DOI 10.24432/C5W894, and the CC BY 4.0 licence.cntis the target;casualandregisteredare components of that target and must never be used as input features.