Koan-style unit tests to practice the core topics from Wes McKinney’s Python for Data Analysis (3rd ed.).
Book (open edition): Python for Data Analysis, 3E
This repo is a practice workbook for the book:
-
You learn by fixing tests:
pyteststarts red; you implement small functions inkoans/until it turns green. -
Chapter-aligned: each
tests/test_XX_*.pyfile maps to a book theme; seedocs/overview.md. -
Docs: see
docs/ -
Koans (tests you complete by editing code): see
tests/
Create a virtualenv and install dependencies:
python3 -m venv .venv
. .venv/bin/activate
python -m ensurepip --upgrade
python -m pip install -U pip
pip install -e ".[dev]"Run the koans:
pytest -qSome later-chapter koans are optional and will be skipped unless you install extras:
pip install -e ".[io]" # parquet (pyarrow)
pip install -e ".[viz]" # plotting (matplotlib)
pip install -e ".[modeling]" # modeling (scikit-learn)KOAN=01 pytest -q # python basics
KOAN=07 pytest -q # time series- Tests start out failing with clear messages.
- You fix them by editing functions in
koans/. - Re-run
pytestand iterate.