Think Stats
Allen B. Downey teaches probability and statistics to Python programmers through code instead of formulas, using real datasets. The third edition is free online as Jupyter notebooks that run on Colab, so you can explore distributions, estimation, hypothesis tests and regression without installing anything.
3rd edition (2024)
Think Stats site · Sept 2026
14 plus worked examples
Think Stats site · Sept 2026
1.1k (AllenDowney/ThinkStats)
GitHub · Sept 2026
Book
Other
Green Tea Press
A few weeks, one chapter at a time
Beginner
Free
What the book is
Think Stats: Exploratory Data Analysis in Python by Allen B. Downey describes itself as "an introduction to Probability and Statistics for Python programmers". Its thesis, kept since the first edition, is that many ideas that are hard to explain with maths are easier to explain with code. In the third edition Downey has "doubled down" on this, to the point where there is almost no mathematical notation left.
The third edition is free to read online and is published under a Creative Commons licence that lets you copy and adapt it for non-commercial use with attribution. A printed edition is also sold through book retailers.
What it covers
Fourteen chapters: exploratory data analysis, distributions, probability mass functions, cumulative distribution functions, modelling distributions, probability density functions, relationships between variables, estimation, hypothesis testing, least squares, multiple regression, time series analysis, survival analysis and analytic methods. Case studies use real datasets, including data from the National Institutes of Health, and extra worked examples tackle questions like whether a result could be luck.
Is it worth your time?
If you can already program in Python and statistics feels like a wall of symbols, this is one of the best ways in. Every idea is something you compute, plot and poke at, so you build intuition by running small experiments. It also teaches good exploratory habits: look at the distribution before you trust a mean, and question where the data came from.
Where it fits for a data science learner
Read it early, as your statistics foundation, before a statistical learning textbook. It gives you distributions, estimation, sampling error and hypothesis testing in working code, which makes later modelling and experiment analysis far less mysterious.
Prerequisites
Downey writes that he assumes you know core Python, including object-oriented features, and basic mathematics such as logarithms and summations. Knowing NumPy and pandas helps but is not necessary, and no statistics background is assumed.
How to run the code
Each chapter is a Jupyter notebook with a link to run it on Google Colab, which the author strongly recommends for at least the first few chapters because you install nothing. If you prefer your own machine, you need Python, Jupyter and libraries including NumPy, SciPy and StatsModels.
What you can do after it
You can explore a new dataset methodically, choose and fit a distribution, estimate a quantity with an honest measure of uncertainty, run and interpret a hypothesis test, and fit a regression with pandas and StatsModels.
Common questions
Is it free? The online version is free. Buying the print book is optional.
How long does it take? One chapter per sitting or two is a comfortable pace; do the exercises at the end of each notebook.
Ready to start?
Opens on Green Tea Press in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.