ThinkStats2 is a textbook and code repository that teaches statistics and data science to Python programmers through practical examples and exercises.
The project addresses the challenge of learning statistics in an applied, hands-on way rather than through abstract theory. It works by pairing explanatory text with executable Python code that demonstrates statistical concepts using real datasets from sources like the National Institutes of Health. Readers learn probability and statistics by writing short programs to run experiments and explore data, building intuition through direct engagement rather than memorization.
The tool suits anyone with basic Python skills who wants to develop practical data analysis abilities. It works well for self-directed learners and students in educational settings, since each chapter provides both example code and exercise solutions in separate Jupyter notebooks. The project emphasizes simple, exploratory techniques for answering questions with real data rather than advanced statistical theory. All materials are available under a Creative Commons license, and the notebooks run directly in a web browser through Colab without requiring local setup.
The repository maintains the second edition materials while a third edition has been published elsewhere. The project structure provides parallel notebooks for each chapter—one with examples and exercises, another with solutions—making it straightforward for learners to attempt problems before reviewing answers. The codebase remains stable and accessible as a reference implementation for the textbook content.