Preface
A sport made of data, argued about from memory
Cricket was keeping statistics before most sports had rules written down. Scorers have recorded every ball in pencil for well over two centuries; the scorebook is one of the game's oldest artefacts, and the batting average one of its oldest arguments. A modern T20 match is broadcast with a ball-tracking replay of almost every delivery. An estimated two and a half billion people follow the game — in Dhaka and Durban, Lahore and Leeds, Colombo, Chennai, Christchurch and Port of Spain — and a great many of them can recite numbers about their favourite players the way other people recite poetry.
And yet, most of the numbers that cricket argues with are the ones it has always argued with: the batting average, the bowling average, the economy rate, a career aggregate. They were designed for a game played over five days on uncovered pitches, and they are now asked to judge a twenty-year-old who faces fourteen balls at the death of an IPL chase. They do not fit, and everyone half-knows it. Commentators reach for "strike rate in the last five overs" or "average against spin"; fans quote "his record in wins". Those are the right instincts. What has been missing is the method: a shared way to turn the instinct into a number you can compute, check and defend.
Baseball went through this transition a generation ago. Michael Lewis's Moneyball (2003) told the story of a club that could not afford stars, discovered that the market priced players by crude statistics, and bought the skills that those statistics missed. The lesson was never really "on-base percentage good, batting average bad". It was: measure what actually wins, find where the market measures it badly, and act before everyone else catches on. Baseball now has a whole shelf of analytics books, public datasets curated for decades, and university courses built around them. Basketball and football followed.
Cricket's version of that moment is arriving now, and it is arriving for three reasons at once. First, the data has become free: ball-by-ball records of tens of thousands of matches can be downloaded by anyone. Second, the game has changed faster than its statistics. In the IPL, totals of 200 or more in the first innings happened 94 times in the fifteen seasons from 2008 to 2022, and 118 times in the four seasons from 2023 to 2026. A number that meant "excellent" in 2015 means "par" today, and a career average that spans both eras is averaging two different sports. Third, cricket now has a genuine market — the IPL auction — in which franchises spend hundreds of crores of rupees every year on prices set partly by reputation, nationality and last season's highlights. Where a market prices with crude measures, careful measurement is worth money. Baseball taught us that much.
What cricket has not had, as far as we know, is a comprehensive textbook that teaches all of this from the ground up — free to read, free to copy, with every analysis reproducible on an ordinary laptop. There are excellent blog posts, a scattering of academic papers, statistics columns by writers who have done this work for years, and the proprietary models of commercial analytics firms, which by their nature are not published. This book tries to fill the gap: forty chapters that start with "what is a strike rate?" and finish with win-probability models, tournament simulations, auction strategy and a working analytics dashboard you have built yourself.
The promise: every number is computed
Here is the promise this book makes, and the one that shaped every page of it:
Every number about a real player, team, match or league in this book is computed from data you can download yourself, and the code that computes it is in the book.
That sounds like a technicality. It is not. It is the whole difference between analytics and opinion.
The first outline of this book contained a neat, confident paragraph comparing Virat Kohli and Suryakumar Yadav in the IPL. It gave Kohli a batting average of 37.25 and a death-overs strike rate of 139; it gave Suryakumar a death-overs strike rate of 193. The story it told — the steady accumulator who can't finish against the explosive finisher — was exactly the kind of story cricket loves.
Then we computed the numbers from every IPL ball bowled from 2008 to the end of the 2026 season. Kohli's average is 40.42, not 37.25. His career strike rate in overs 16 to 20 is 188.38 — higher than Suryakumar's 178.21, not lower. The real gap between them sits in the middle overs, where Suryakumar has scored at 144.14 and Kohli at 125.80. The story was not slightly wrong; it was backwards. Chapter 1 opens with that table, and it is the right place to start, because it shows the trap this book is built to avoid. Numbers recalled from memory, however confident, are a form of eye test. Numbers computed from data, with their definitions stated, are something you can check.
So throughout the book you will see the code that produced each table, followed by the output it actually printed. When we use a famous number — Rohit Sharma's ODI average in matches India won (58.46) and lost (36.01), say — you can rerun the script and get the same figures. When a number in common circulation turns out to be wrong, we say so and show how we know.
The honesty that comes with the promise
A promise like that only means something if the limits of the data are stated just as plainly. Four of them run through the whole book.
Ball-tracking data is not public, so the book's tracking layer is simulated — and labelled every time. Hawk-Eye trajectories, pitch locations, release speeds and the angle of each shot are owned and sold by the companies that collect them. Cricsheet records what happened on every ball — the runs, the extras, the wicket — but not where it pitched or where it was hit. Pitch maps, beehives, wagon wheels and expected-wickets models are central to modern analysis, and you cannot learn them without data to try them on. So the book's toolkit attaches simulated location columns to real deliveries: the outcomes are real, the locations are generated to be plausible given those outcomes. Every use of that layer carries a 🧪 Simulated data label, every such chart says so in its title, and no simulated number is ever presented as a fact about a real bowler. You learn the method on the simulated layer; the book then tells you what a franchise with the real feed would see differently.
Afghanistan's men's international matches are not in the data. Cricsheet withholds men's Tests, ODIs and T20 internationals involving Afghanistan by policy. In this book's snapshot that is 14 Tests, 162 ODIs, 166 T20 internationals and 10 non-official T20 internationals. Afghan players — Rashid Khan, Noor Ahmad, Rahmanullah Gurbaz and others — appear only through the franchise leagues, so the book never presents an international or "career" figure for them. When we quote Rashid Khan's 500 wickets in 392 matches, we say exactly what it is: his record in the franchise leagues in the data, not his T20 career.
Names are not identities. Cricsheet records players under one spelling each, and spellings collide. There are three different men called "Rashid Khan" in the men's T20 internationals alone. Chamari Athapaththu appears as "AC Jayangani". Every delivery in the data also carries a registry identifier for each player involved, and the toolkit gives you a function to pin a name to one human being before you aggregate across competitions. The book uses it, and so should you.
Cricsheet is not the official record. For older matches its figures can differ from official statistics by a run or a match. Coverage starts in December 2001 for men's Tests and in 2008 for the IPL; there is no Bradman in here. Where we compare a computed figure with a famous official one, we say which is which.
None of these limits makes the data less useful. Stating them is what makes it trustworthy.
The stance: a practitioner who respects the eye test
This book is written from the practitioner's side of the game — the side where a win-probability curve has to be explained on air in ten seconds, where a valuation has to be ready before the auction starts, and where a model has to be explained to a coach who has forgotten more about cricket than any model knows. That experience shapes three convictions you will meet on almost every page.
This is a cricket book that uses statistics, not a statistics book with cricket examples. Every section begins with a cricket question — who should bowl the nineteenth over, is this batter really weak against off-spin, should the captain declare now — and the statistics arrive only when the question needs them.
Test, ODI and T20 cricket are three different sports. A wicket is the scarcest thing in a Test match; in a T20 innings the scarce thing is balls. Since 2016, matches between full members have produced a wicket every 55.5 balls in Tests and every 17.6 balls in men's T20 internationals. Every metric in this book is introduced with the format it belongs to, and none is carried across formats without checking that it still means something.
Analytics complements the eye test; it does not replace it. The data does not know that the bowler has a sore shoulder, that there is a crack on a good length at one end, or that two batters at the crease have not spoken since the last tour. The best analysis combines what the numbers show with what experienced cricket people see. Throughout the book, a 🏏 Eye test callout marks the places where a coach would notice something the data cannot — or where the data shows something the eye reliably misses. A sceptical former fast bowler, Wendell, will argue with us often, and he will be right more than once.
Two further convictions follow from those. Small samples are cricket's permanent condition: a T20 innings is twenty to sixty balls, an IPL league stage fourteen games, and a great deal of what passes for "form" is noise. So the book teaches shrinkage, regression to the mean and honest intervals early, and uses them everywhere. And variance is not failure: a good pre-match model is right perhaps 60 to 65 percent of the time, and the best team loses often. Analytics is about making better decisions under uncertainty, not about removing it.
The game is global, and so is the book
The examples come from every corner of the cricket world: Newlands and Eden Gardens, Mirpur and Headingley, the Big Bash, the Caribbean Premier League, the Pakistan Super League, the SA20, the T20 Blast. Women's cricket is in the data and in the book — Laura Wolvaardt's 571 runs and Deepti Sharma's 22 wickets at the 2025 Women's World Cup, the Women's Premier League, the Women's Big Bash — analysed with the same methods and the same seriousness, and with its own baselines rather than men's numbers borrowed for the purpose.
And the book is built for the reader its title page imagines: a fan in Dhaka with a five-year-old laptop and an unreliable connection. Everything here uses free data and free software. The whole data snapshot fits in about 140 MB of disk. No chapter needs a graphics card, a paid account or a cloud service.
Who this book is for
You do not need a statistics background; the book teaches it from scratch, with cricket. You do not need to have programmed before; Python is taught from the first line in Chapters 2 and 3. You do need to know cricket — what a wicket, an over, a no-ball, an LBW and a declaration are — and to be comfortable with percentages and averages.
Beyond that, the book is written for several kinds of reader at once:
- Fans who want to watch the game and see what the numbers reveal that the commentary misses.
- Students of statistics, data science or computer science who love cricket and want a real project to learn on.
- Aspiring analysts who want to work for a franchise, a broadcaster, a board or a data company, and need a portfolio to prove it.
- Journalists and broadcasters who want analytical depth and charts that tell a story.
- Coaches at any level who want to use data without surrendering their judgement to it.
- Fantasy players and betting analysts who want a disciplined, sceptical, probability-literate approach — and an honest account of how hard it is to beat a market.
- Franchise and board strategists who want to think about squads, auctions and selection with evidence.
The Learning Paths page maps a route through the book for each of these readers, and How to Use This Book explains how the chapters, callouts and code fit together. If you want to start running code straight away, go to Setting Up Your Environment; if you want to know exactly what is in the data before you trust a number from it, read About the Data.
The readers of this book are the people who will bring cricket's Moneyball moment to their club, their broadcast, their franchise or their argument at the tea stall. The data is free. The tools are free. The book is free. Let's begin.