Master cheat sheet
The master cheat sheet is the course in reference form. It has 57 pages in eight groups. Each page has:
- a “Quick lookup” table (I want to… → use…);
- dense tables and compact code with one-line comments;
- a “Gotchas” section;
- links to the lessons that teach the topic in depth.
The Python and OOP pages are general-purpose: use them for web, scripting and automation work too. The module cheat sheets (one per module, linked from each lesson) go deeper on a single topic.
All code on these pages runs as shown, and every output is real.
PythonSyntax, strings, collections, functions, generators, decorators, errors, files, stdlib, regex, type hints, pytest, performance, tooling, idioms
Object-oriented programmingClasses, inheritance, ABC vs Protocol, dunder methods, data containers, enums, design patterns
Algorithms & data structuresBig-O, amortized analysis, LRU cache, tries, Union-Find, KD-trees, Bloom filters, graphs, DP and algorithm patterns
DataNumPy, pandas, Polars, Matplotlib, Seaborn, Plotly, SciPy stats, statsmodels, SQL and DuckDB
Math & statisticsLinear algebra, SVD, calculus, optimization, autograd, Bayesian inference, information theory, causal DAGs and GLMs
Machine learningscikit-learn API, preprocessing, models, metrics, CV and tuning, boosting, unsupervised, time series, NLP, PyTorch, interpretability, deployment
Decision guidesWhich data structure, chart, statistical test, algorithm, metric, CV strategy; pandas vs Polars vs SQL
ML workflow and printable pageThe end-to-end checklist with a flowchart, and every page on one printable page
Quick lookup
Section titled “Quick lookup”| I want to… | Use… |
|---|---|
format numbers in a report (1,234.50, 12.5%) |
Strings and f-string formatting |
| pick a list, dict, set, deque or DataFrame | Which data structure |
| write a decorator or a context manager | Decorators and context managers |
| parse text with a regular expression | Regular expressions |
| add type hints that mypy accepts | Type hints |
| test a function with pytest fixtures | pytest |
| set up a project with uv, ruff and pyproject | Tooling |
| avoid the classic Python traps | Idioms and gotchas |
make my object work with len(), in or + |
Dunder methods |
| choose dataclass, NamedTuple, TypedDict or pydantic | Data containers |
| group, pivot or merge tables | pandas |
| run fast queries on large files | Polars and SQL and DuckDB |
| choose a chart for my question | Which chart |
| choose a statistical test | Which statistical test |
| check Big-O, tries, Union-Find, graphs or DP patterns | Complexity & structures and Algorithm patterns |
| look up QR, SVD, Jacobians, Hessians or optimizers | Linear algebra and Calculus & optimization |
| run Bayesian A/B tests, KL drift, IPW or GLMs | Probability & Bayesian and Causal inference & GLMs |
| build a leakage-safe preprocessing pipeline | scikit-learn API and Preprocessing |
| choose an ML algorithm | Which ML algorithm |
| choose a metric | Which metric and Metrics |
| choose a cross-validation strategy | Which CV strategy |
| tune XGBoost or LightGBM | Gradient boosting libraries |
| forecast a time series | Time series |
| train a neural network | PyTorch |
| explain a model’s predictions | Interpretability |
| serve a model behind an API | Deployment and MLOps basics |
| follow the whole ML process step by step | ML workflow |
| print everything or save it as a PDF | Printable cheat sheet |
How to use the cheat sheet
Section titled “How to use the cheat sheet”- Search first. The site search (top of the page) indexes every table row.
- Start from the lookup table of a page. It points to the right section.
- Copy a snippet, then run it on the course data in your own project folder.
- When a row is not enough, follow “Learn more” to the lesson that teaches it.
Gotchas
Section titled “Gotchas”- Library versions matter. The pages match the versions pinned in the course
requirements.txt(pandas 3, NumPy 2, scikit-learn 1.9, PyTorch 2.15). Older tutorials online often use removed or deprecated APIs. - A cheat sheet shows the common path. Check edge cases (missing values, empty inputs, ties) in your own data before you rely on a snippet.
- Several pages repeat the same rule because it matters everywhere: fit preprocessing on training data only, and read the test set once.