Python programs operate on objects with explicit input, ownership and failure contracts.
Learning roadmap
This section contains 25 written lessons or quiz banks. Programs are verified on CPython 3.14.6. Standard-library lessons target 3.11+ syntax; lessons using data, web, machine-learning or testing packages state their tested dependencies separately. Framework programs use local test clients, not a deployed service. Read the stated limits before adapting a fixture into an application.
NumPy buffers and shapes
Read the contract, run its program and inspect the failure case.
- NumPy slices and indexed copies: verify who owns the buffer
- NumPy broadcasting: declare axes and bound integer arithmetic
Pandas missing values and cardinality
Read the contract, run its program and inspect the failure case.
- Pandas nullable integers: missing amounts are not zero
- Pandas joins: cardinality validation and missing lookup keys
Aggregation, rendering and evaluation
Read the contract, run its program and inspect the failure case.
- Pandas groupby: retain missing keys and define all-null totals
- Pandas rolling windows: minimum observations and causal boundaries
- Pandas chunked CSV aggregation: validate every chunk before returning totals
- NumPy floating-point checks: finite values and declared tolerances
- Matplotlib figures: render a labeled report without a display server
- Scikit-learn pipelines: fit preprocessing on training data only
- Python classification metrics: fix label order before counting errors
Time bins, null identifiers and linear models
Read the contract, run its program and inspect the failure case.
- Pandas resample: choose time-bin boundaries and preserve empty hours
- Pandas merge with null keys: quarantine missing identifiers before matching
- NumPy least squares: inspect rank before trusting fitted coefficients
Shape policy, category acceptance and bounded resampling
Read the contract, run its program and inspect the failure case.
- Pandas pivot: duplicates need an aggregation policy before reshaping
- Pandas categorical values: reject unknown labels before conversion
- NumPy bootstrap means: seeded resampling does not repair biased input
Declared sampling and temporal evaluation policies
Read the contract, run its program and inspect the failure case.
- Python quantiles: choose an interpolation policy before reporting a threshold
- Python time-series validation: fit on past rows and leave a declared gap
Paired estimates and declared axes
Read the contract, run its program and inspect the failure case.
- Python covariance: state the denominator and preserve paired observations
- Python NumPy shape validation: reject accidental broadcasting before arithmetic
Ordered joins and invalid numbers
Read the contract, run its program and inspect the failure case.
- Pandas merge_asof: match an earlier event within a declared tolerance
- NumPy finite gate: reject NaN and infinity before computing totals
Join shape and missing groups
Read the contract, run its program and inspect the failure case.
- Pandas merge(validate=): reject an unintended many-to-many join
- Pandas groupby(dropna=False): keep a missing category visible
Continue learning
Move between tutorial, collections, advanced material and practice using the subject tabs. The sidebar changes with each section; related examples keep one canonical lesson URL.
