7 routes42 sections324 units

Unit 1.1 · about 5 h

1 / 324

Notebook 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

  1. Python
    Kaggle Learn — Python

    Complete lessons 1–7: syntax, functions, conditionals, lists, loops, strings/dictionaries and external libraries.

  2. Google Colab FAQ
    Google Colab FAQ — free resources and limits

    Use a hosted notebook for setup-light practice. Read the free-resource limitations; no GPU availability is guaranteed.

  3. The Python Tutorial
    The 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

From a blank notebook, import a CSV file, print its shape and column names, compute one summary with a function you wrote, then restart the kernel and reproduce the same output.

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

Kaggle Python exercises

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

  1. Why should you restart the kernel and run all notebook cells before treating the result as reproducible?

  2. What is the difference between a Python list and a function?

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

Resources for this unit

  • Kaggle Learn — Python
    Kaggle Learnprimarycourse
    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
    Python Software Foundationreferencereference
    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
    Google Researchsupportnotebook-environment
    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
    NumPyprimarydocumentation
    Study array creation, shape, indexing, universal functions, broadcasting and basic operations. Write down shapes and dtypes before changing an array.
  • Kaggle Learn — Pandas
    Kaggle Learnprimarycourse
    Complete the short exercises on reading data, selecting, summary functions, grouping, sorting, data types, missing values and combining tables.
  • pandas Getting Started Tutorials
    pandas Development Teamrequireddocumentation
    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
    Matplotlibsupportdocumentation
    Use the Figure/Axes workflow to make labeled line plots, histograms and scatter plots. Keep plots diagnostic rather than decorative.
  • Bike Sharing Dataset
    UCI Machine Learning Repositoryrequireddataset
    Use the hourly hour.csv data for the two linked starter projects. Cite Fanaee-T (2013), DOI 10.24432/C5W894, and the CC BY 4.0 licence. cnt is the target; casual and registered are components of that target and must never be used as input features.

Quick find

Search Michi

Type to search every route, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels