Affiliate disclosure
Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.
Chapter 3 Further Reading — Python and pandas for Cricket
The best way to learn pandas is to use it on questions you care about; these are the sources that make that easier. Inside this book, Appendix A is a pandas-for-cricket reference card and Appendix B documents every column the toolkit produces.
The data
-
Cricsheet (cricsheet.org), maintained by Stephen Rushe. The free ball-by-ball source behind every number in this chapter. Read its notes on the JSON format alongside Chapter 2, and browse a raw match file once — after this chapter you will recognise every field the toolkit flattens, and spot the ones it leaves out (substitute fielders, Impact Player replacements). For everyone.
-
ESPNcricinfo Statsguru. The standard place to cross-check a career aggregate. Use it to spot-check the tables you build here — when a number differs by a run or a match, the reason is usually a definition (super overs, retired-hurt, a match missing from one source), and finding it is good practice. For analysts who want to verify.
Learning the tools
-
Wes McKinney, Python for Data Analysis (O'Reilly). Written by the creator of pandas; the most complete guide to the library's idioms — indexing,
groupby,merge, reshaping, time series. Read the chapters on data wrangling and aggregation after this one; the examples are not cricket, but you will now translate them instantly. For readers on the Analyst Track. -
Hadley Wickham and co-authors, R for Data Science (O'Reilly; also freely readable online). The R world's equivalent, built around the same filter–group–summarise grammar as §3.5–3.7. Worth reading even if you stay in Python: its explanation of tidy data (one row per observation — one delivery — one column per variable) is the clearest statement of why the toolkit's tables look the way they do. Pairs with the book's Appendix J. For R users and the curious.
-
Max Marchi, Jim Albert and Benjamin S. Baumer, Analyzing Baseball Data with R (CRC Press). Baseball's play-by-play data is the closest cousin of cricket's ball-by-ball data, and this book shows how far a sport's analysts can go once the data is wrangled cleanly: run expectancy tables, win probability, player value. Skim it now to see where Parts II–IV of this book are heading. For readers who want the bigger picture.
-
Tinniam V. Ganesh's R packages
cricketrandyorkr(on CRAN; described in the author's blog posts). Long-running open-source tools for analysing cricket data in R,yorkrbuilt on Cricsheet. Useful to compare designs: what functions would you add toexplore.pyafter seeing theirs? Check the current documentation for function names before relying on them. For R users and project builders.
The rules behind the definitions
-
MCC, The Laws of Cricket (the 2017 Code, with later revisions, published free by the MCC). The authority on what a wide, a no-ball, a bye and a leg-bye are — and therefore on why balls faced excludes wides but includes no-balls, and why byes are not charged to the bowler. When a definition in this chapter seems arbitrary, the Laws usually explain it. For everyone.
-
ICC Playing Conditions for Men's and Women's T20Is and ODIs (published by the ICC). Where the phase boundaries come from — the fielding restrictions that make overs 1–6 of a T20 and 1–10 of an ODI a different game — and the rules for free hits and reduced matches. For readers who want to know why the
phasecolumn is split where it is.
Making the first charts readable
-
Edward Tufte, The Visual Display of Quantitative Information (Graphics Press). The classic on showing data honestly: maximise the ink that carries data, compare like with like. Figures 3.3 and 3.4 — bars with the strike rate written on them, a heat map with the sample in every cell — are small applications. Chapter 7 takes these ideas much further. For anyone who will show a chart to someone else.
-
William S. Cleveland, The Elements of Graphing Data (Hobart Press). The research behind why some charts are read accurately and others are not — position along a common scale beats colour and area. Read it before you build a heat map you expect people to read precisely. For analysts and broadcast-graphics readers.