Free course · 13 hands-on notebooks · runs on any laptop
Python 1001
From data structures to deploying services, compiled extensions and research-grade science. Three modules, Intro, Medium and Advanced, each a set of notebooks with real, executed results you can read here or run yourself.
- 13notebooks
- ~17 hof study
- 3levels
- 100%runnable code
Measured, not claimed
Every comparison in the course is run: file formats timed, memory peaks measured per process, speed-ups benchmarked, models scored on held-out data. When a technique does not help, the notebook says so.
From script to production
Environments, lock files, Docker, testing, logging, packaging and publishing: the practices that turn code that runs on your machine into software other people can use.
Python at the frontier
The Advanced module uses the libraries researchers rely on, in biology, medicine, physics, space, economics, AI and forecasting, and ends with a complete Kaggle challenge.
Syllabus
Three modules, 13 notebooks. Read the explanations, run the cells, then try the exercises at the end of each notebook. Your progress is remembered in this browser.
Intro
Data structures, formats, data larger than memory, environments, containers and editors.
Python Data Structures
Lists, tuples, dictionaries and sets, the collections module, functions, a first look at classes, comprehensions, generators and exceptions, and why the choice of structure matters, measured.
- list, tuple, dict, set
- collections
- functions
- generators
- exceptions
- Big-O
Data Formats and pandas
The pandas DataFrame, then CSV, JSON, Excel, Parquet, Feather, SQLite, YAML, TOML and pickle compared on the same data: size, speed and which types survive.
- pandas
- CSV & JSON
- Parquet
- SQLite
- YAML & TOML
- pickle safety
Large Data on Limited RAM
Measure memory honestly, shrink DataFrames with the right types, stream in chunks, read only what you need from Parquet, and compare pandas with Polars, DuckDB and PyArrow.
- memory profiling
- categoricals
- chunking
- Polars
- DuckDB
- PyArrow
Environments, Packages, Containers and Editors
Isolated environments, pip, uv, pipx, conda, apt and snap, lock files, Docker for deployment, and the editors professionals use: VS Code, PyCharm, Eclipse, Vim.
- venv
- pip & uv
- conda
- lock files
- Docker
- IDEs
Medium
Object-oriented and Pythonic programming, testing, concurrency, and building, publishing and maintaining libraries.
Object-Oriented Python
The four pillars, the data model and special methods, properties, dataclasses, abstract base classes and protocols, composition, the MRO and __slots__.
- classes
- dunder methods
- properties
- dataclasses
- Protocol
- composition
Pythonic Techniques
Iterators, decorators, context managers, functional tools, type hints, logging, testing with pytest, and threads versus processes versus asyncio, measured.
- generators
- decorators
- context managers
- typing
- pytest
- concurrency
Libraries: Speed Up, Package, Publish, Contribute
Speed up hot loops with NumPy, Numba, Cython and C, build a wheel from pyproject.toml, publish with trusted publishing, version without breaking users, and contribute upstream.
- Numba
- Cython
- C extensions
- pyproject.toml
- PyPI
- SemVer & deprecation
Advanced
Python at the frontier: biology, medicine, physics, space, economics, AI frameworks, time series forecasting and a Kaggle capstone.
Life Sciences: Biology and Medicine
Sequences, simulated evolution and a reconstructed family tree with Biopython, survival analysis of a breast-cancer trial with lifelines, and a diagnostic model tuned for sensitivity.
- Biopython
- alignment
- phylogeny
- Kaplan-Meier
- Cox regression
- ROC
Physics and Space Research
Derive a pendulum symbolically with SymPy, simulate it with SciPy, find its frequency with an FFT, verify Kepler's third law with Astropy, and integrate an orbit checked by conservation laws.
- SymPy
- SciPy ODEs
- FFT
- Astropy units
- Kepler
- orbits
Economics and Econometrics
Fifty years of US data with statsmodels: Okun's law with robust standard errors, its stability across decades, and an ARIMA forecast backtested against naive baselines.
- statsmodels
- OLS & HAC
- Okun's law
- ARIMA
- backtesting
AI Frameworks: PyTorch and TensorFlow
The same convolutional network in PyTorch and in TensorFlow/Keras: tensors, automatic differentiation, training loops, saving and exporting, and how to choose.
- PyTorch
- TensorFlow
- Keras
- autograd
- CNN
- ONNX
Time Series Forecasting
Seasonal naive, SARIMA, Prophet, XGBoost, a GRU in PyTorch, an LSTM in Keras and a Transformer on two problems: bike demand, where gradient boosting wins, and river flow, where neural networks win, and why.
- seasonal naive
- SARIMA
- Prophet
- XGBoost
- GRU & LSTM
- Transformer
Capstone: Solving a Kaggle Challenge
Kaggle's House Prices challenge end to end: licensing, the log-RMSE metric, exploration, feature engineering in a Pipeline, cross-validation, blending and a submission file.
- Kaggle
- data licensing
- feature engineering
- Pipeline
- cross-validation
- blending
Run it yourself
Each lesson page shows the notebook with its saved outputs, so the whole course can be read in the browser. To experiment, download a notebook or open it in Google Colab from the lesson page, or clone the repository and run everything locally (module 04 explains every step of this):
git clone https://github.com/fborbon/academy.git
cd academy/python
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
jupyter lab
What you need
- Python: none for the Intro module beyond having written a few lines of code; each module builds on the previous one.
- Maths: school level. The Advanced notebooks explain the science they use as they go.
- Hardware: any laptop from the last decade. Every notebook runs on a CPU in minutes; two notebooks download a small dataset once. Notebook 03's PySpark section needs Java 17+.
Data and credits
- Most data is generated in the notebooks or ships with the libraries (scikit-learn, statsmodels, lifelines).
- Ames Housing data: De Cock, D. (2011), Journal of Statistics Education 19(3), via OpenML (public).
- GBSG2 breast-cancer trial: Schumacher et al. (1994), Journal of Clinical Oncology, as distributed with lifelines.
- US macroeconomic data: as distributed with statsmodels (
macrodata). - Bike Sharing data: Fanaee-T, H. and Gama, J. (2013), Progress in Artificial Intelligence, UCI repository (CC BY 4.0), via OpenML.
- Planetary orbital elements: standard published values (NASA planetary fact sheets).