Appendix B — Data Dictionary and Toolkit Reference
Every number in this book is computed from data you can download and code you can read. This
appendix is the map of both: what is in each table, column by column; which competitions the data
snapshot covers; the people register and the reference tables in data/reference/; every public
function in the toolkit (toolkit/cricdata.py, venues.py, tracking_sim.py); the Crease modules
built chapter by chapter; and — just as important — what the data does not contain.
Nothing below was typed from memory. The script appendices/code/b_data_dictionary.py loads the real
Parquet files, reads the column lists from them, counts the competitions, inspects the reference
tables, prints the toolkit's function signatures with worked examples, and checks each known gap
against the data. Its full output is in appendices/code/b_data_dictionary_output.txt; extracts are
pasted below. Run it from the book folder (about ten seconds once the cache exists):
python appendices/code/b_data_dictionary.py
(On a Windows console set PYTHONIOENCODING=utf-8 first — see
Appendix A, §A.1.)
How the toolkit builds these tables, line by line, is the subject of Chapter 2; the pandas you need to use them is in Chapter 3 and Appendix A; the metrics built on them are defined in Appendix C.
Contents
| § | Topic |
|---|---|
| B.1 | The deliveries table (42 columns) and the matches table (27 columns) |
| B.2 | Coded values: every phase, wicket kind, result and method in the data |
| B.3 | The competitions: codes, match counts, date ranges, season labels |
| B.4 | The people register and player identity |
| B.5 | The reference tables in data/reference/ |
| B.6 | Toolkit API: cricdata.py, venues.py, tracking_sim.py |
| B.7 | The Crease modules in project/crease/ |
| B.8 | Known data gaps |
| B.9 | The data folder, file by file |
B.1 The two tables
The toolkit flattens each Cricsheet archive into two tables:
- deliveries — one row per delivery, legal or not (a wide is a row; so is a super-over ball);
- matches — one row per match.
All twenty archives share exactly the same columns, which is what lets one line of code run on the IPL, the WPL, men's Tests or the T20 Blast:
deliveries: 42 columns; IPL 295,732 rows; men's Tests 1,730,523 rows
...
all 20 deliveries files share one column list: True
all 20 matches files share one column list: True
deliveries columns whose dtype differs between IPL and Tests: {'target_runs': 'object', 'target_overs': 'object'}
The one type difference is harmless: Tests never have a target (B.8), so pandas stores the all-empty
target_* columns as object instead of float64.
B.1.1 Deliveries — 42 columns
The first 38 come from parsing each delivery (parse_match()); the last four are copied from the
matches table when the cache is built, so you can filter balls by season, date, venue or gender
without a merge. "Missing" is the share of rows with no value, in the IPL and in men's Tests. The
example values come from one real delivery: the first wicket of the IPL 2026 final (match 1535465,
Ahmedabad, 31 May 2026) — Shubman Gill caught by Rajat Patidar off Josh Hazlewood in the third over —
except the two target_* values, taken from the first ball of that match's second innings.
Identity and position
| Column | Type | Missing IPL / Tests | Meaning | Example | Caveats |
|---|---|---|---|---|---|
match_id |
text | 0 / 0 | Cricsheet match id (the JSON file name) | '1535465' |
Text, not a number: balls["match_id"] == "1535465" |
competition |
text | 0 / 0 | archive code (B.3) | 'ipl' |
|
match_type |
text | 0 / 0 | T20, ODI, Test, IT20 |
'T20' |
The Hundred is typed T20; IT20 = non-official men's internationals |
innings |
int | 0 / 0 | innings number within the match | 1 |
1–2 in limited-overs matches, 1–4 in Tests; super overs are numbered 3–8 |
super_over |
bool | 0 / 0 | True for super-over balls | False |
The book's batting and bowling tables exclude them |
batting_team |
text | 0 / 0 | team batting | 'Gujarat Titans' |
Franchise names change over time (B.8) |
bowling_team |
text | 0 / 0 | the other team | 'Royal Challengers Bengaluru' |
|
over |
int | 0 / 0 | 1-based over number | 3 |
The Hundred: 1–20 five-ball sets |
ball_in_over |
int | 0 / 0 | legal balls so far in this over; for a wide or no-ball, the number of the ball being bowled (legal so far + 1) | 2 |
Can reach 7 — umpires occasionally miscount (eight IPL overs had five or seven legal balls) |
legal_ball_index |
float | 3.75% / 0.86% | legal balls so far in the innings, counting this one | 14.0 |
Empty on wides and no-balls (hence float); the safe way to measure "balls bowled" |
delivery_seq |
int | 0 / 0 | order of the delivery within the match, 1, 2, 3… across all innings | 17 |
The sort key: sort_values(["match_id", "delivery_seq"]) |
People
| Column | Type | Missing IPL / Tests | Meaning | Example | Caveats |
|---|---|---|---|---|---|
batter |
text | 0 / 0 | striker (Cricsheet display name) | 'Shubman Gill' |
Names are not unique (B.4) |
bowler |
text | 0 / 0 | bowler | 'JR Hazlewood' |
|
non_striker |
text | 0 / 0 | non-striker | 'B Sai Sudharsan' |
|
batter_id |
text | 0 / 0 | registry identifier of the striker | 'b4b99816' |
Eight hex characters; never missing in any archive |
bowler_id |
text | 0 / 0 | registry identifier of the bowler | '03806cf8' |
|
non_striker_id |
text | 0 / 0 | registry identifier of the non-striker | 'd5130a30' |
|
player_out_id |
text | 95.03% / 98.33% | registry identifier of the dismissed player | 'b4b99816' |
Empty when no wicket fell |
Runs and extras
| Column | Type | Missing | Meaning | Example | Caveats |
|---|---|---|---|---|---|
runs_batter |
int | 0 | runs off the bat | 0 |
Includes runs hit off a no-ball; 5s exist (overthrows); a 4 or 6 can be run (B.2) |
runs_extras |
int | 0 | all extras on the delivery | 0 |
= wides + noballs + byes + legbyes + penalty |
runs_total |
int | 0 | runs_batter + runs_extras | 0 |
Use for team totals and run rates; not for batting |
wides |
int | 0 | wide runs | 0 |
A wide that runs away for four is recorded as 5 wides |
noballs |
int | 0 | no-ball runs (the penalty) | 0 |
Runs off the bat from a no-ball are in runs_batter |
byes |
int | 0 | byes | 0 |
Not charged to the bowler |
legbyes |
int | 0 | leg-byes | 0 |
Not charged to the bowler |
penalty |
int | 0 | penalty runs awarded on this delivery | 0 |
Rare (10 runs in the whole IPL); innings-level penalties are not here (B.8) |
Flags and the dismissal
| Column | Type | Missing IPL / Tests | Meaning | Example | Caveats |
|---|---|---|---|---|---|
is_legal |
bool | 0 / 0 | neither a wide nor a no-ball | True |
Count legal balls with is_legal.sum() |
is_four |
bool | 0 / 0 | 4 off the bat and not flagged as a non-boundary | False |
21 IPL deliveries had four off the bat that were not boundaries |
is_six |
bool | 0 / 0 | 6 off the bat, not a non-boundary | False |
|
is_wicket |
bool | 0 / 0 | any wicket fell on this delivery | True |
Includes run-outs, retired hurt, retired out — not only bowler wickets |
wicket_kind |
text | 95.03% / 98.33% | how the (first) wicket fell | 'caught' |
Thirteen values (B.2); empty means "no wicket", not "unknown" |
player_out |
text | 95.03% / 98.33% | who was out | 'Shubman Gill' |
Can be the non-striker (run-outs): 565 IPL run-outs dismissed a batter other than the striker |
fielders |
text | 95.03% / 98.33% | fielders credited, joined with "; " |
'RM Patidar' |
Empty string "" (not missing) for wickets with no named fielder — bowled, lbw, caught-and-bowled, some run-outs (3,984 of 14,705 IPL wickets). Substitute fielders appear by name only; the raw files' substitute flag is not carried over (Chapter 17 reads it from the zips) |
n_wickets_on_ball |
int | 0 / 0 | number of wickets recorded on the delivery | 1 |
The toolkit keeps only the first wicket in wicket_kind/player_out; check this column for the rare exceptions (B.2) |
Phase, target, declaration
| Column | Type | Missing IPL / Tests | Meaning | Example | Caveats |
|---|---|---|---|---|---|
phase |
text | 0 / 0 | powerplay, middle, death, or none |
'powerplay' |
T20 overs 1–6 / 7–15 / 16–20; ODI 1–10 / 11–40 / 41–50; The Hundred balls 1–25 / 26–75 / 76–100; Tests none |
target_runs |
float | 51.88% / 100% | runs the chasing side needed to win | 156.0 |
Set on every ball of a limited-overs second innings (the revised target after a rain rule); empty in first innings, in super overs and in every Test |
target_overs |
float | 51.88% / 100% | overs available for the chase | 20.0 |
Below 20 / 50 after a reduction |
declared |
bool | 0 / 0 | this innings was declared | False |
Repeated on every ball of the innings; Tests only in practice (530 declared Test innings) |
Copied from the matches table
| Column | Type | Example | Caveats |
|---|---|---|---|
season |
text | '2026' |
Text, and not always one year: '2020/21' is IPL 2020 (B.3) |
start_date |
datetime | 2026-05-31 |
The match's first day — not the day the ball was bowled in a Test |
venue |
text | 'Narendra Modi Stadium, Ahmedabad' |
Spellings vary across years for the same ground |
gender |
text | 'male' |
Essential in The Hundred, whose archive holds both |
B.1.2 Matches — 27 columns
Example values are the IPL 2026 final.
| Column | Type | Missing IPL / Tests | Meaning | Example | Caveats |
|---|---|---|---|---|---|
match_id |
text | 0 / 0 | the key shared with deliveries | '1535465' |
Unique within each table |
competition |
text | 0 / 0 | archive code | 'ipl' |
|
match_type |
text | 0 / 0 | T20 / ODI / Test / IT20 |
'T20' |
|
gender |
text | 0 / 0 | male / female |
'male' |
|
team_type |
text | 0 / 0 | international / club |
'club' |
Franchise leagues are club |
season |
text | 0 / 0 | Cricsheet season label | '2026' |
See B.3 |
start_date |
datetime | 0 / 0 | first day of the match | 2026-05-31 |
|
n_days |
int | 0 / 0 | number of scheduled dates in the file | 1 |
Tests: 2–6 dates; the one six-date Test is India v New Zealand at Southampton, June 2021 (id 1249875) |
event_name |
text | 0 / 0.89% | tournament or series name | 'Indian Premier League' |
|
match_number |
float | 5.95% / 2.78% | match number within the event | nan |
Empty for playoffs (they have a stage instead) |
stage |
text | 94.05% / 99.67% | playoff stage | 'Final' |
League matches have none — don't dropna() on it |
venue |
text | 0 / 0 | ground | 'Narendra Modi Stadium, Ahmedabad' |
|
city |
text | 4.10% / 10.90% | city | 'Ahmedabad' |
Genuinely missing for some grounds (all 51 IPL gaps are Dubai and Sharjah); venues.py falls back on the venue name |
team1, team2 |
text | 0 / 0 | the two teams, in the file's order | 'Gujarat Titans', 'Royal Challengers Bengaluru' |
Not home/away and not batting order — get batting order from the deliveries' innings |
toss_winner |
text | 0 / 0 | won the toss | 'Royal Challengers Bengaluru' |
|
toss_decision |
text | 0 / 0 | bat / field |
'field' |
|
winner |
text | 2.01% / 18.80% | winning team | 'Royal Challengers Bengaluru' |
Empty for ties, no-results and draws (all 169 missing Test winners are draws) |
result |
text | 0 / 0 | win, tie, draw, no result |
'win' |
|
win_by_runs |
float | 55.11% / 44.61% | margin in runs | nan |
Set when the side batting first wins (and for innings wins) |
win_by_wickets |
float | 46.90% / 74.30% | margin in wickets | 5.0 |
Set when the chasing side wins |
win_by_innings |
bool | 0 / 0 | won by an innings | False |
169 Tests |
method |
text | 98.15% / 99.89% | result method | None |
D/L, VJD, Awarded, Lost fewer wickets (B.2); empty = normal result |
eliminator |
text | 98.71% / 100% | winner of a tie-break (super over) | None |
The team that went through after a tie; winner stays empty |
overs_per_side |
int | 0 / 100% | scheduled overs per side | 20 |
Empty for Tests; The Hundred is 20 (five-ball sets); 19 T20 matches carry 50 in the source (B.2) — use match_type to pick a format |
balls_per_over |
int | 0 / 0 | balls per over | 6 |
5 for every match of The Hundred |
player_of_match |
text | 0 / 0 | award winner(s), joined with "; " |
'V Kohli' |
Empty string when none was named (9 IPL matches) |
B.2 Coded values
The distinct values of every coded column, across all twenty archives (6,420,141 deliveries; 17,186 matches):
match_type: {'T20': 2923484, 'Test': 1730523, 'ODI': 1713385, 'IT20': 52749}
phase: {'middle': 2454115, 'none': 1730523, 'powerplay': 1365520, 'death': 869983}
innings numbers (super overs excluded): [1, 2, 3, 4]
innings numbers on super-over balls: [3, 4, 5, 6, 7, 8]
n_wickets_on_ball: {0: 6182038, 1: 238090, 2: 12, 10: 1}
wicket_kind (all archives):
wicket_kind
caught 134846
bowled 47368
lbw 22317
run out 18348
caught and bowled 7346
stumped 7167
retired hurt 346
hit wicket 226
retired out 96
obstructing the field 25
retired not out 15
handled the ball 2
hit the ball twice 1
result: {'win': 16496, 'no result': 356, 'draw': 169, 'tie': 165}
method: {None: 16498, 'D/L': 677, 'Awarded': 5, 'VJD': 5, 'Lost fewer wickets': 1}
toss_decision: {'field': 9809, 'bat': 7377}
team_type: {'international': 10225, 'club': 6961}
gender: {'male': 13563, 'female': 3623}
balls_per_over: {6: 16797, 5: 389}
overs_per_side: {20: 13031, 50: 3256, None: 899}
match_type x overs_per_side:
overs_per_side none 20 50
match_type
IT20 0 239 1
ODI 0 0 3237
T20 0 12792 18
Test 899 0 0
IPL stage values: {'Final': 19, 'Qualifier 2': 16, 'Qualifier 1': 16, 'Eliminator': 13, 'Semi Final': 6, 'Elimination Final': 3, '3rd Place Play-Off': 1}
matches with win_by_innings True (Tests): 169
What the codes mean for analysis:
- Wicket kinds and the book's definitions. Bowler wickets are
bowled,caught,caught and bowled,lbw,stumped,hit wicket(cricdata.BOWLER_WICKET_KINDS). Batting "outs" are every wicket kind exceptretired hurtandretired not out(cricdata.NOT_DISMISSAL) — soretired outis an out. Run-outs count against the batter who was out but not for any bowler. - Several wickets on one ball. Twelve deliveries record two wickets and one records ten — a
women's T20I between the United Arab Emirates and Qatar in 2025 (id
1483765) in which ten United Arab Emirates batters are all recorded asretired outon one delivery in the 16th over. The toolkit keeps only the first wicket inwicket_kindandplayer_out;n_wickets_on_balllets you find these thirteen rows. - Methods.
D/Lcovers Duckworth–Lewis and its successor Duckworth–Lewis–Stern (Chapter 23);VJD(the V. Jayadevan method) appears on five Syed Mushtaq Ali Trophy matches;Awarded(five matches) andLost fewer wickets(one T20 Blast tie-break) are rare. Most of the book's "decided normally" filters aremethod.isna() & winner.notna(). - Super overs use innings numbers 3–8 (a tied super over is followed by another). Filter them
with
super_over, never withinnings <= 2, because Tests legitimately have innings 3 and 4. overs_per_sideis 50 on eighteen T20Is and one non-official T20 — a quirk of the source files. Choose a format withmatch_type(or the archive code), notovers_per_side.- Stages are free text from the source ("Semi Final", "Elimination Final", "Eliminator"…). Map them
yourself if you need a clean "playoff" flag;
stage.notna()is a reliable "not a league match" test.
B.3 The competitions
Twenty Cricsheet archives make up the book's snapshot (downloaded 18 November 2026). Row counts come from each Parquet file's footer; dates from the matches tables:
matches deliveries first last seasons gender match_type bpo
code
tests_male 899 1730523 2001-12-19 2026-10-28 50 male Test 6
odis_male 2617 1388641 2002-06-27 2026-11-02 50 male ODI 6
t20s_male 3649 820658 2005-02-17 2026-11-01 45 male T20 6
t20s_female 2200 499978 2009-06-18 2026-10-25 35 female T20 6
it20s_male 240 52749 2010-06-04 2024-05-26 10 male IT20 6
odis_female 620 324744 2007-01-22 2026-10-28 36 female ODI 6
ipl 1243 295732 2008-04-18 2026-05-31 19 male T20 6
bbl 662 153250 2011-12-16 2026-01-25 15 male T20 6
psl 357 83799 2016-02-04 2026-05-03 12 male T20 6
cpl 445 103717 2013-07-30 2026-09-20 14 male T20 6
sat 130 29020 2023-01-10 2026-01-25 4 male T20 6
hnd 389 75636 2021-07-21 2026-08-16 6 female/male T20 5
ilt 134 31407 2023-01-13 2026-01-04 4 male T20 6
mlc 109 25529 2023-07-13 2026-07-18 4 male T20 6
bpl 469 111232 2012-02-11 2026-01-23 12 male T20 6
lpl 143 32917 2020-11-26 2026-08-08 6 male T20 6
ntb 1570 360545 2014-05-16 2026-07-18 13 male T20 6
sma 695 158839 2016-01-02 2024-12-15 9 male T20 6
wpl 88 20656 2023-03-04 2026-02-05 4 female T20 6
wbb 527 120569 2015-12-18 2026-11-02 12 female T20 6
TOTAL: 17,186 matches, 6,420,141 deliveries, 20 archives
The Hundred by gender: {'male': 201, 'female': 188}
Matches withheld (each archive's README): {'tests_male': 14, 'odis_male': 162, 't20s_male': 166, 'it20s_male': 10}
| Code | Competition | Format family | Notes |
|---|---|---|---|
tests_male |
Men's Test matches | Test | from December 2001; no women's Tests in the snapshot |
odis_male |
Men's One-Day Internationals | ODI | |
t20s_male |
Men's T20 Internationals | T20 | includes associate nations; most name collisions live here (B.4) |
t20s_female |
Women's T20 Internationals | T20 | |
it20s_male |
Men's non-official international T20s | T20 (IT20) |
ends May 2024 |
odis_female |
Women's One-Day Internationals | ODI | |
ipl |
Indian Premier League | T20 | 2008–2026 |
bbl |
Big Bash League | T20 | |
psl |
Pakistan Super League | T20 | |
cpl |
Caribbean Premier League | T20 | |
sat |
SA20 | T20 | |
hnd |
The Hundred (men's and women's) | 100-ball | typed T20; five-ball "overs"; filter on gender |
ilt |
International League T20 | T20 | |
mlc |
Major League Cricket | T20 | |
bpl |
Bangladesh Premier League | T20 | |
lpl |
Lanka Premier League | T20 | |
ntb |
Vitality T20 Blast | T20 | |
sma |
Syed Mushtaq Ali Trophy | T20 | ends December 2024 in this snapshot |
wpl |
Women's Premier League | T20 | |
wbb |
Women's Big Bash League | T20 |
When the book says "all men's T20" it means men's T20Is plus the eleven men's leagues above (with
The Hundred's men's matches where stated); the non-official it20s_male archive is listed
separately.
Season labels
season is text in Cricsheet's convention, which sometimes names a season with two years. The labels
in four archives:
ipl season labels: ['2007/08', '2009', '2009/10', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020/21', '2021', '2022', '2023', '2024', '2025', '2026']
wpl season labels: ['2022/23', '2023/24', '2024/25', '2025/26']
bpl season labels: ['2011/12', '2012/13', '2015/16', '2016/17', '2017/18', '2018/19', '2019/20', '2021/22', '2022/23', '2023/24', '2024/25', '2025/26']
odis_female season labels: ['2006/07', '2007/08', '2008', '2008/09', '2009', '2009/10', '2011/12', '2012', '2012/13', '2013', '2013/14', '2014', '2014/15', '2015', '2015/16', '2016', '2016/17', '2017', '2017/18', '2018', '2018/19', '2019', '2019/20', '2020/21', '2021', '2021/22', '2022', '2022/23', '2023', '2023/24', '2024', '2024/25', '2025', '2025/26', '2026', '2026/27']
The IPL's 2008 season is '2007/08', its 2010 season '2009/10' and its 2020 season (played
September–November) '2020/21'. The WPL's 2026 season is '2025/26'. International archives mix
single-year and split-year labels within the same year. Rule: to get a year, use
start_date.dt.year, or Crease's data.season_years(), which dates each season by its first
match (Appendix A, §A.9).
B.4 The people register and player identity
Cricsheet's people register (data/raw/people.csv, loaded by cricdata.load_people()) has one row
per person and maps the eight-character identifier used on every delivery to the person's ids in
other databases:
18,698 people, 22 columns
columns: ['identifier', 'name', 'unique_name', 'key_bcci', 'key_bcci_2', 'key_bigbash', 'key_cricbuzz', 'key_cricheroes', 'key_crichq', 'key_cricinfo', 'key_cricinfo_2', 'key_cricinfo_3', 'key_cricingif', 'key_cricketarchive', 'key_cricketarchive_2', 'key_cricketworld', 'key_nvplay', 'key_nvplay_2', 'key_opta', 'key_opta_2', 'key_pulse', 'key_pulse_2']
people with each external key:
key_cricinfo 18653
key_cricketarchive 4508
key_pulse 2010
key_bcci 1321
key_nvplay 1142
key_bigbash 296
key_cricingif 130
key_cricketworld 127
key_cricheroes 111
key_cricinfo_2 104
key_opta 67
key_cricbuzz 50
key_nvplay_2 36
key_crichq 24
key_pulse_2 13
key_bcci_2 8
key_cricinfo_3 1
key_cricketarchive_2 1
key_opta_2 1
display names shared by 2+ people: 275 (covering 592 people)
identifier name unique_name key_cricinfo
5d2eda89 S Mandhana S Mandhana 597806.0
ba607b88 V Kohli V Kohli 253802.0
| Column | Meaning |
|---|---|
identifier |
Cricsheet's id for the person — the value in batter_id, bowler_id, non_striker_id, player_out_id |
name |
the display name used in the ball-by-ball files (batter, bowler…) — not unique |
unique_name |
a disambiguated name, e.g. Rashid Khan (2) |
key_cricinfo |
ESPNcricinfo player id (the number at the end of a profile address) — the bridge to Statsguru; present for 18,653 of 18,698 people |
key_* |
ids in other databases (BCCI, CricketArchive, Pulse, NV Play, Opta…); _2/_3 columns hold second ids where one person has two |
Names are not identities. 275 display names in the register belong to two or more people. In the delivery tables, Chapter 2 found 68 names that map to two or more people within one competition (38 in men's T20Is) and 127 across the snapshot; the IPL has exactly one, which the script confirms:
IPL names carried by 2+ registry ids: ['Harmeet Singh']
IPL rows with a name but no id: 0
The rules (Chapter 2, §2.9):
- Within one competition, grouping by name is usually safe — but check, especially in men's T20Is, where "Rashid Khan" by name is three different people (from Belgium, Nepal, and the ICC World XI appearance of the Afghan leg-spinner).
- Across competitions, group by the
_idcolumns, or pin the person you mean withcricdata.only_player(balls, name)before summarising (B.6). - Joining a reference table (styles, auction prices) by name, also match on
gender: "SR Taylor" is Steven Taylor (USA, male) and Stafanie Taylor (West Indies, female); "RP Singh" is R. P. Singh (India, male) and Ritu Priya Singh (USA, female). - One person can appear under two spellings across years: "NR Sciver" and "NR Sciver-Brunt" share
the identifier
f3a18a0c("KH Sciver-Brunt" is a different player,6a434bd3). Group by id when following a career. And some players appear under a name you might not search for — Chamari Athapaththu is "AC Jayangani".
B.5 The reference tables
Cricsheet records who did what, not what they cost or how they bowl. Two sourced tables in
data/reference/ add those columns. Each has a *_SOURCES.md file beside it documenting where every
value came from; read it before you publish anything built on the table.
ipl_auction.csv — IPL auction prices, retentions and trades, 2022–2026
ipl_auction.csv: 879 rows x 13 columns
event mega_auction mini_auction retention rtm trade All
season
2022 204 0 33 0 0 237
2023 0 80 0 0 5 85
2024 0 72 0 0 7 79
2025 174 0 46 8 0 228
2026 0 77 163 0 10 250
All 378 229 242 8 22 879
rows with a cricsheet_name: 802 (91.2%); blank: 77
role: {nan: 266, 'Bowler': 226, 'All-rounder': 208, 'Batter': 107, 'Wicketkeeper': 72}
price_lakh range: 20 to 2700
season event player cricsheet_name team price_lakh
2025 mega_auction Rishabh Pant RR Pant Lucknow Super Giants 2700
2026 retention Rishabh Pant RR Pant Lucknow Super Giants 2700
2026 retention Shreyas Iyer SS Iyer Punjab Kings 2675
| Column | Type | Meaning | Caveats |
|---|---|---|---|
season |
int | IPL season (calendar year) | A real integer here, unlike Cricsheet's season |
event |
text | mega_auction, mini_auction, retention, trade, rtm (2025 right-to-match buys) |
Mega auctions in 2022 and 2025 |
player |
text | name as the source gives it | |
cricsheet_name |
text | matched Cricsheet display name | Blank for 77 rows — mostly buys who have not played an IPL match in the data |
team |
text | buying/retaining team, in Cricsheet's naming for that season | "Royal Challengers Bangalore" to 2023, "Bengaluru" from 2024 |
price_lakh |
int | price in ₹ lakh (₹1 crore = 100 lakh) | Auction rows: hammer price. Retention and trade rows: the salary — which can differ from the amount deducted from the purse |
base_price_lakh |
float | reserve price | Blank where sources conflict or are silent; none for retentions/trades |
nationality |
text | ||
overseas |
bool | nationality is not India | 291 rows True |
capped |
text | True / False / blank |
Blank for retention and trade rows (the source gives none) |
role |
text | Batter / Bowler / All-rounder / Wicketkeeper | Normalised from the source; blank for retention and trade rows (266) |
acquisition |
text | detail, e.g. "auction purchase", "right-to-match card", "traded from …" | Free text |
source |
text | the fixed source page revision each row came from |
Scope (from ipl_auction_SOURCES.md): sold players only — no unsold lists; 2023 and 2024
retentions are not included; withdrawals and in-season replacements are not included. The sources
file lists the six price corrections applied after cross-checking against independent published
lists, and confirms each season's auction total. Purses: ₹90 crore (2022), ₹95 crore (2023), ₹100
crore (2024), ₹120 crore (2025) and ₹125 crore (2026, per the season's published records). Chapters
13 and
34 use this table.
To join prices to performance, merge on cricsheet_name and check the team/season, or use the id
helpers in crease.valuation_batting (auction_ids), which resolve each name to a registry id.
player_styles.csv — batting hand and bowling style (v3, 2,011 players)
player_styles.csv: 2,011 rows x 10 columns
columns: ['cricsheet_name', 'gender', 'full_name', 'country', 'batting_hand', 'bowling_style', 'bowling_type', 'bowling_arm', 'confidence', 'note']
gender: {'male': 1421, 'female': 590} | confidence: {'high': 1601, 'medium': 381, 'low': 29}
bowling_type: {'pace': 908, 'spin': 760, nan: 343} | batting_hand: {'Right': 1516, 'Left': 495}
rows with a note: 194 | duplicated cricsheet_name: 4
| Column | Meaning | Caveats |
|---|---|---|
cricsheet_name |
display name as in the deliveries | Join on name and gender — two names (SR Taylor, RP Singh) belong to a man and a woman |
gender |
male / female |
|
full_name, country |
for humans | |
batting_hand |
Right / Left |
|
bowling_style |
ESPNcricinfo-style wording, e.g. Right-arm offbreak, Slow left-arm orthodox, Right-arm legbreak googly |
Blank for players with no balls bowled in the data |
bowling_type |
pace / spin |
Blank = does not bowl (343 rows) |
bowling_arm |
right / left |
|
confidence |
high / medium / low |
Use high + medium for published analysis; 29 rows are low |
note |
shared names, split sources, unverified fields | e.g. "register has several Rashid Khans; this is the Afghan (cricinfo 793463)" |
The twelve most common bowling styles:
Right-arm offbreak 366
Right-arm medium 327
Slow left-arm orthodox 199
Right-arm fast-medium 185
Right-arm medium-fast 172
Right-arm legbreak 125
Right-arm fast 87
Right-arm legbreak googly 55
Left-arm fast-medium 47
Left-arm medium 38
Left-arm medium-fast 33
Left-arm fast 19
How it was built (from player_styles_SOURCES.md): every player with at least 1,200 (men) / 600
(women) legal balls faced or bowled in the book's competitions since 2015 (men) / 2016 (women) —
1,008 men and 543 women — resolved from Cricsheet name → register identifier → ESPNcricinfo id →
Wikidata → Wikipedia infobox, with web summaries for associate players without infoboxes. Two
extensions followed: 322 earlier-era men (Muralitharan, Warne, Kumble, Vettori, Zaheer Khan, Saeed
Ajmal…), which raised the share of men's Test legal balls bowled by a typed bowler from 70.9% to
96.9%; and 138 recent IPL, WPL and full-member T20I players, which raised typed coverage of 2026
legal balls to 96.6% in the IPL and 99.6% in the WPL. The four source files
(player_styles_male.csv, _female.csv, _male_ext.csv, _recent_ext.csv: 1,008 + 543 + 322 + 138
= 2,011 rows) are kept beside the merged table. The table will not grow again; chapters written
before an extension say so where their coverage figures differ.
player_styles_sim_v1.csv — the frozen copy for the simulator
player_styles_sim_v1.csv: 1,551 rows x 10 columns
gender: {'male': 1008, 'female': 543} | confidence: {'high': 1156, 'medium': 366, 'low': 29}
bowling_type: {'pace': 696, 'spin': 595, nan: 260} | batting_hand: {'Right': 1180, 'Left': 371}
rows in live v3 but not in the frozen simulator copy: 460
toolkit/tracking_sim.py reads this frozen 1,551-row snapshot of the original table, never the
live one, so that adding players to player_styles.csv could never shift anyone's simulated
locations and every simulated figure in the book reproduces exactly. Bowlers missing from it (the
460 later additions) get a hash-based pace/spin guess in the simulation only. Use the live
player_styles.csv for every real analysis of bowling type, and never edit the frozen copy.
Working files
Files starting with an underscore are build artefacts kept for transparency:
_ipl_auction_matchlog.csv (how each auction row was matched to a Cricsheet name, with the player's
team history), _ipl_names.txt (IPL batter and bowler names), and _style_candidates*.csv (the
players selected for the styles table with their ball counts). You do not need them to use the
tables.
B.6 Toolkit API
The toolkit is three files in toolkit/. Import them after the standard header
(Appendix A, §A.1). Signatures are printed from the code by
inspect.signature:
cricdata.py public functions:
batter_dismissed(balls: 'pd.DataFrame') -> 'pd.Series'
batting_summary(balls: 'pd.DataFrame', by: 'list[str] | str' = 'batter') -> 'pd.DataFrame'
bowler_wicket(balls: 'pd.DataFrame') -> 'pd.Series'
bowling_summary(balls: 'pd.DataFrame', by: 'list[str] | str' = 'bowler') -> 'pd.DataFrame'
build(code: 'str', data_dir: 'Path | str' = <book>/data, force: 'bool' = False) -> 'tuple[Path, Path]'
download(code: 'str', data_dir: 'Path | str' = <book>/data, force: 'bool' = False) -> 'Path'
load_deliveries(code: 'str' = 'ipl', data_dir: 'Path | str' = <book>/data) -> 'pd.DataFrame'
load_many(codes: 'list[str]', data_dir: 'Path | str' = <book>/data) -> 'pd.DataFrame'
load_matches(code: 'str' = 'ipl', data_dir: 'Path | str' = <book>/data) -> 'pd.DataFrame'
load_people(data_dir: 'Path | str' = <book>/data) -> 'pd.DataFrame'
only_player(balls: 'pd.DataFrame', name: 'str') -> 'pd.DataFrame'
parse_match(data: 'dict', match_id: 'str', competition: 'str') -> 'tuple[dict, list[dict]]'
primary_id(balls: 'pd.DataFrame', name: 'str', role: 'str' = 'batter') -> 'str | None'
runs_conceded(balls: 'pd.DataFrame') -> 'pd.Series'
venues.py public functions:
add_home_away(balls: 'pd.DataFrame', matches: 'pd.DataFrame') -> 'pd.DataFrame'
add_host(matches: 'pd.DataFrame') -> 'pd.DataFrame'
condition_bucket(country: 'str') -> 'str'
host_country(city: 'str | None', venue: 'str | None') -> 'str'
tracking_sim.py public functions:
add_tracking(balls: 'pd.DataFrame', styles: 'pd.DataFrame | None' = None, seed: 'int' = 2026) -> 'pd.DataFrame'
load_styles(path: 'Path | str | None' = None) -> 'pd.DataFrame | None'
(The script prints the full local path of the default data_dir; it is shown here as <book>/data.)
B.6.1 cricdata.py — loading and the canonical summaries
Constants
| Name | Value / meaning |
|---|---|
COMPETITIONS |
dict of the 20 archive codes → full names (B.3) |
BASE_URL |
https://cricsheet.org/downloads/{code}_json.zip |
PEOPLE_URL |
https://cricsheet.org/register/people.csv |
DATA_DIR |
<book>/data by default; set the environment variable CRICDATA_DIR to keep the data elsewhere |
BOWLER_WICKET_KINDS |
{'bowled', 'caught', 'caught and bowled', 'hit wicket', 'lbw', 'stumped'} |
NOT_DISMISSAL |
{'retired hurt', 'retired not out'} |
Download, parse, cache, load
| Function | Returns | What it does | Notes |
|---|---|---|---|
download(code, data_dir=DATA_DIR, force=False) |
Path of data/raw/<code>_json.zip |
fetches one Cricsheet archive unless it is already on disk | force=True re-downloads |
parse_match(data, match_id, competition) |
(match_row: dict, delivery_rows: list[dict]) |
turns one parsed match JSON into one match dict (27 keys) and one dict per delivery (38 keys) | Used by build; call it yourself to inspect a single file |
build(code, data_dir=DATA_DIR, force=False) |
(deliveries_path, matches_path) |
downloads if needed, parses every match in the zip, merges four match columns onto deliveries, writes both Parquet files (write-then-swap, so a crash never leaves a half-written cache) | Returns at once if both files exist. force=True re-parses but does not re-download — call download(code, force=True) first to refresh from Cricsheet |
load_deliveries(code="ipl", data_dir=DATA_DIR) |
DataFrame, 42 columns | build then pd.read_parquet |
Reads every column — for the Tests table use pd.read_parquet(build(c)[0], columns=[...]) or Crease's data.load(code, columns=...) |
load_matches(code="ipl", data_dir=DATA_DIR) |
DataFrame, 27 columns | same for matches | |
load_people(data_dir=DATA_DIR) |
DataFrame, the people register | downloads people.csv once, then reads it |
B.4 |
load_many(codes, data_dir=DATA_DIR) |
DataFrame | concatenates deliveries from several archives | No columns=; mind memory and name collisions |
d_path, m_path = cricdata.build("wpl") # cache hit: returns the two paths, parses nothing
mrow, drows = cricdata.parse_match(json.load(zf.open(first_json)), Path(first_json).stem, "wpl")
two = cricdata.load_many(["wpl", "wbb"])
build('wpl') -> data\processed\wpl_deliveries.parquet | data\processed\wpl_matches.parquet
download('wpl') -> data\raw\wpl_json.zip
parse_match('1358929.json') -> match dict with 27 keys, 217 delivery dicts with 38 keys
load_many(['wpl','wbb']).shape = (141225, 42)
From the command line, python toolkit/cricdata.py ipl wpl builds (or confirms) those caches and
prints their sizes — the quickest way to prepare a new machine. Add --force to rebuild the Parquet
caches from the downloaded archives (python toolkit/cricdata.py ipl wpl --force); arguments starting
with -- are treated as options, everything else as a competition code. To fetch a fresh archive from
Cricsheet first, call download(code, force=True) from Python.
Row-level helpers — each returns a Series aligned with balls:
| Function | Returns | Definition |
|---|---|---|
batter_dismissed(balls) |
bool Series | is_wicket and player_out == batter — the striker was out (excludes non-striker run-outs; includes retired hurt of the striker) |
bowler_wicket(balls) |
bool Series | wicket_kind in BOWLER_WICKET_KINDS |
runs_conceded(balls) |
int Series | runs_total − byes − legbyes − penalty (wides and no-balls charged to the bowler) |
batter_dismissed(wpl).sum() = 1032 | is_wicket.sum() = 1079 | bowler_wicket(wpl).sum() = 1000
runs_conceded(wpl).sum() = 26932 | runs_total.sum() = 27378
Across all four WPL seasons: 1,079 wicket deliveries, of which 1,032 dismissed the striker and 1,000 are credited to a bowler; bowlers were charged 26,932 of the 27,378 runs scored.
The canonical summaries — the book's definitions live here and only here:
batting_summary(balls, by="batter") -> DataFrame, indexed by by, sorted by runs, with columns:
| Column | Definition |
|---|---|
runs |
runs off the bat |
balls |
balls faced: deliveries as striker, excluding wides (no-balls count) |
fours, sixes |
boundaries (is_four, is_six) |
dots |
balls faced with no run off the bat |
outs |
dismissals of the player, striker or non-striker, excluding retired hurt and retired not out |
innings |
distinct (match, innings) in which the player batted, as striker or non-striker |
average |
runs / outs (NaN when never out) |
strike_rate |
100 × runs / balls |
dot_pct |
100 × dots / balls |
boundary_ball_pct |
100 × (fours + sixes) / balls |
boundary_run_pct |
100 × (4 × fours + 6 × sixes) / runs |
bowling_summary(balls, by="bowler") -> DataFrame, indexed by by, sorted by wickets, with columns:
| Column | Definition |
|---|---|
balls |
legal deliveries bowled |
runs |
runs conceded (runs_conceded) |
wickets |
bowler wickets (bowler_wicket) |
dots |
legal balls conceding nothing |
boundaries |
legal balls hit for 4 or 6 |
matches |
distinct matches |
overs |
cricket notation: 32.5 means 32 overs and 5 balls — not 32.5 overs; compute with balls, never with overs |
economy |
6 × runs / balls |
average |
runs / wickets |
strike_rate |
balls / wickets |
dot_pct, boundary_pct |
per 100 legal balls |
w26 = wpl[wpl["season"] == "2025/26"]
batting_summary(w26)[["innings", "runs", "balls", "outs", "average", "strike_rate"]].head(3)
bowling_summary(w26)[["matches", "overs", "runs", "wickets", "economy"]].head(3)
batting_summary(WPL 2025/26).head(3):
innings runs balls outs average strike_rate
batter
S Mandhana 9 377 246 7 53.86 153.25
H Kaur 8 342 227 5 68.40 150.66
NR Sciver-Brunt 7 321 212 5 64.20 151.42
bowling_summary(WPL 2025/26).head(3):
matches overs runs wickets economy
bowler
SFM Devine 9 32.5 272 17 8.28
NSS Sharma 10 38.0 316 17 8.32
N de Klerk 9 32.0 251 16 7.84
Caveats for both summaries:
- Both drop super-over balls themselves.
bycan add any column:["batter", "season"],["bowler", "phase"],"batter_id". With"innings"inby, the result has both aninningsindex level and aninningscount column — rename the index level beforereset_index().- Batting rows come from balls faced, so a player who faced no balls in the data passed in (run out at the non-striker's end without facing) has no row, and that dismissal is invisible.
bowling_summarycountsoverswith six balls; for The Hundred useballs.- Pass rows for one person: aggregate by id or through
only_playerwhen combining archives.
Identity helpers
| Function | Returns | What it does |
|---|---|---|
primary_id(balls, name, role="batter") |
id string, or None |
the registry id with the most deliveries under name in that role ("batter" or "bowler") |
only_player(balls, name) |
a copy of balls |
renames rows where the name matches but the id is not the primary id to "<name> (other)" in batter, bowler, non_striker and player_out — nothing is deleted, so summaries on the result describe one person |
primary_id(wpl, 'S Mandhana') = 5d2eda89
only_player(two, 'S Mandhana') — names renamed to '(other)': 0
Here nothing needed renaming. Chapter 2's example is the one that matters: across the eleven archives
in which the Afghan leg-spinner appears, "Rashid Khan" by name is 396 matches and 504 wickets; after
only_player, his own line is 392 matches, 500 wickets at an economy of 6.90, and four matches of
two other bowlers move to "Rashid Khan (other)". That figure covers the franchise leagues in the data
plus one World XI T20I; it is not his T20 career, because Afghanistan's internationals are withheld
(B.8).
B.6.2 venues.py — host country, conditions, home and away
| Name | Kind | Returns / meaning |
|---|---|---|
HOST_CITIES |
dict | country → list of cities (16 countries: India, England, Australia, South Africa, New Zealand, Pakistan, Sri Lanka, Bangladesh, West Indies, Zimbabwe, Afghanistan, Ireland, UAE, USA, Scotland, Netherlands) |
SENA, SUBCONTINENT |
sets | {Australia, England, New Zealand, South Africa}, {Bangladesh, India, Pakistan, Sri Lanka} |
host_country(city, venue) |
str | country from the city; if the city is missing or unknown, from known venue names, then from any known city name inside the venue string; else "Other" |
condition_bucket(country) |
str | SENA, Subcontinent, West Indies, UAE or Other |
add_host(matches) |
DataFrame (copy) | adds host_country, conditions, home_team (the team whose name equals the host country, else None) |
add_home_away(balls, matches) |
DataFrame | merges those onto deliveries and adds venue_status ∈ {home, away, neutral} for the batting side |
host_country('Mirpur', None) = Bangladesh
host_country(None, 'Dubai International Cricket Stadium') = UAE
host_country('Kabul', None) = Afghanistan | host_country('Nairobi', None) = Other
condition_bucket('Pakistan') = Subcontinent | condition_bucket('Ireland') = Other
add_host(men's Tests) conditions: {'SENA': 456, 'Subcontinent': 292, 'West Indies': 86, 'Other': 34, 'UAE': 31}
host_country 'Other': 0 | home_team None (neutral or unmapped): 36
add_home_away(men's Test deliveries) venue_status: {'away': 829993, 'home': 820605, 'neutral': 79925}
add_home_away(IPL deliveries) venue_status: {'neutral': 295732} (franchise names never equal a country, so every IPL ball is 'neutral')
Caveats:
- Home is defined by nationality, so it works for international cricket only. Every franchise
match comes out
neutral. For franchise home grounds usecrease.venue_toss.infer_home_team(Chapter 22). - Every men's Test maps to a known host; 36 have no home team (neutral venues such as Pakistan's "home" Tests in the UAE, and finals at neutral grounds).
Otherconditions include Zimbabwe, Ireland and Afghanistan as hosts; the bucket is a deliberate simplification for SENA-versus-subcontinent questions (Chapter 16, Chapter 18).- Unknown cities fall through to
Other; extendHOST_CITIESin your own copy if you analyse grounds outside the list. Appendix F covers grounds in detail (Appendix F).
B.6.3 tracking_sim.py — the simulated tracking layer
🧪 Simulated data: everything this module adds is simulated. The outcomes are real Cricsheet deliveries; the locations, speeds and shot directions are drawn at random, conditioned on those real outcomes. Never quote a
sim_value as a fact about a real player.
Ball-tracking (Hawk-Eye and similar systems), pitch maps, release speeds and shot directions are not public. The module exists so the book can teach the methods that need them (Chapter 15, Chapter 7, Chapter 32) with code that runs.
| Name | Returns / meaning |
|---|---|
load_styles(path=None) |
the frozen styles copy player_styles_sim_v1.csv (1,551 rows), or None if absent |
add_tracking(balls, styles=None, seed=2026) |
a copy of balls, sorted by match_id, delivery_seq with a new 0…n−1 index, with 16 sim_ columns added |
LENGTHS |
['yorker', 'full', 'good', 'short', 'bouncer'] |
LINES |
['wide_off', 'off', 'stumps', 'leg'] |
ZONES, ZONE_ANGLE |
eight scoring zones and their centre angles (degrees; 0 = straight, positive = off side for a right-hander) |
PITCH_RANGE, BASE_MIX, OUTCOME_TILT, LINE_MIX, LINE_CM |
the simulation's parameter tables — read them to understand its artefacts |
The 16 columns:
| Column | Type | Meaning |
|---|---|---|
sim_bowler_type_known |
bool | the bowler is in the frozen styles table (otherwise pace/spin was guessed from a hash of the name) |
sim_bowler_type |
text | pace / spin |
sim_length |
text | one of LENGTHS |
sim_pitch_m |
float | where the ball pitched, metres from the batter's stumps |
sim_line |
text | one of LINES (every wide is wide_off) |
sim_line_cm |
float | centimetres from middle stump at the popping crease; positive = the batter's off side |
sim_stump_y_cm, sim_stump_z_cm |
float | beehive coordinates as the ball passes the stumps: lateral offset and height (0–200 cm) |
sim_speed_kmh |
float | release speed |
sim_variation |
text | pace: stock, yorker, bouncer, slower_ball; spin: stock, variation |
sim_swing_deg |
float | swing angle; negative = reverse swing |
sim_reverse |
bool | reverse swing (Tests, old ball, pace only) |
sim_spin_rpm |
int | spin rate; 0 for pace |
sim_shot_zone |
text | one of ZONES; empty when no run was scored off the bat |
sim_shot_angle_deg |
float | shot direction (mirrored for left-handers) |
sim_shot_dist_m |
float | shot distance |
sim_wpl = tracking_sim.add_tracking(wpl) # whole competition, then filter
load_styles() rows: 1551
add_tracking(wpl): 16 sim_ columns added; rows 20,656
sim_length shares: {'good': 0.434, 'full': 0.278, 'short': 0.188, 'yorker': 0.058, 'bouncer': 0.043}
sim_bowler_type_known share: 0.876
sim_shot_zone missing share (balls with no run off the bat): 0.416
deterministic (same input, same output): True
Rules for using it:
- Simulate a whole competition, then filter. The random draws depend on the exact rows passed in,
so
add_tracking(load_deliveries("ipl"))followed by a filter gives the same values in every chapter; simulating a filtered subset does not. - The output is re-sorted and re-indexed. Don't align it with the input by index; merge on
match_id+delivery_seqif you need to. - Gender: if the input has one gender, styles are matched on it; The Hundred's mixed archive is
matched on name only — filter
hndby gender before simulating if a shared name matters. - Label every use
🧪 Simulated datain prose and "simulated tracking layer — real outcomes, simulated locations" on figures. Chapter 15 shows how much of any pattern in these columns is the simulator talking (for example, an LBW model whose skill vanishes when the labels are shuffled).
B.7 The Crease modules
Crease is the analytics package you build across the book, one module per chapter, in
project/crease/. Each module depends only on the toolkit and the standard scientific libraries (and,
where noted in its docstring, on earlier Crease modules). Import with the standard header, then
from crease import batting or from crease.explore import scorecard.
The modules in the finished project/crease/ (Chapters 2–37), with the first line of each module's
docstring and its number of public functions and classes (section 7 of the script):
| Module | Chapter | Public names | What it does (from its docstring) |
|---|---|---|---|
data |
2 | 9 | the data layer: cached load(code, columns=), load_games, season_years, filter_balls, season_table, snapshot_inventory, player_registry |
explore |
3 | 17 | first look at a competition: scorecards, over-by-over tables, season summaries, top-N leaderboards |
traditional |
4 | 11 | traditional statistics and "where it lies" diagnostics |
formats |
5 | 11 | format profiles: each format's league baselines |
uncertainty |
6 | 16 | honest numbers for small samples: intervals, reliability, shrinkage |
charts |
7 | 23 | the classic cricket charts (Manhattan, worm, wagon wheel, pitch map, beehive, radar…) |
batting |
8 | 9 | batting metrics beyond the average |
impact |
9 | 17 | batting impact in context: WP v0 table, Expected Runs, WPA |
test_batting |
10 | 16 | Test-match batting: conversion, splits, survival |
matchups |
11 | 14 | batter × bowling-type matchups with hierarchical shrinkage |
partnerships |
12 | 14 | partnerships, strike rotation and the partnership network |
valuation_batting |
13 | 16 | what an IPL batter is worth, in runs, wins and rupees |
bowling |
14 | 16 | bowling beyond economy rate: profiles, xW, luck share, impact |
tracking |
15 | 13 | pitch maps, length/line analysis, variations, clustering, LBW geometry (🧪 simulated layer) |
test_bowling |
16 | 12 | Test-match bowling: spells, pressure, ball age, conditions |
fielding |
17 | 17 | fielding analytics: real dismissal records plus clearly labelled simulated layers |
bowling_types |
18 | 16 | pace vs spin, by conditions, phase and handedness |
states |
19 | 15 | the match as a state space: Expected Runs table, Markov innings model |
winprob |
20 | 20 | WP v1, the book's main win-probability model |
selection |
21 | 18 | team composition, player value in runs, the XI optimiser |
venue_toss |
22 | 17 | toss, venue, home advantage and conditions |
resources |
23 | 16 | resource tables and rain-rule targets |
match_model |
24 | 21 | who wins before the first ball? (the pre-match model) |
projection |
25 | 16 | what will this player do next season? |
translation |
26 | 15 | exchange rates between cricket competitions |
live |
27 | 19 | in-match forecasting |
tournament |
28 | 16 | who lifts the trophy? Monte Carlo tournament simulation |
test_sim |
29 | 22 | pitch deterioration, weather proxies and session-level forecasting for Tests |
batting_order |
30 | 18 | batting-order simulation and optimisation |
bowling_plan |
31 | 29 | who bowls when: phase values, the 20-over allocation problem, the matchup overlay |
fields |
32 | 21 | field placement: the Laws' geometry, real field-restriction effects, a geometric field model (🧪) |
declaration |
33 | 16 | the declaration decision in Test cricket |
auction |
34 | 22 | IPL auction strategy: value, market price, surplus, bids, retention, squads |
betting |
35 | 17 | prices, probabilities, edges, stakes and honest backtests |
fantasy |
36 | 29 | fantasy-points projections, captaincy and an ownership-leverage optimiser |
storytelling |
37 | 23 | broadcast-style graphics and auto-generated match notes |
That is 36 modules and 617 public functions and classes — the same count
Chapter 39 and Chapter 40 report. (Chapter 38's checkpoint
audit counts 588 because it counts public functions only, not classes.) Chapter 39 assembles
everything into a Streamlit dashboard (project/app.py) with smoke tests in project/tests/.
To see the current set, list the folder or run section 7 of the script. Every
module's own docstring lists its public functions with their signatures; help(crease.batting) prints
it.
⚠️ Common pitfall: two functions with one name. Several modules define helpers with the same name for their own chapter's purpose —
load_styles(inmatchups,bowling_types,test_battingand the toolkit'stracking_sim),phase_profile,wilson,entry_positions,innings_table. Import them qualified (from crease import bowling_types as bt; bt.load_styles()) rather than withfrom … import *, and remember that onlytracking_sim.load_stylesreads the frozen simulator copy.
B.8 Known data gaps
Knowing the edges of the data is part of the analysis. Each gap below is checked against the data by section 8 of the script.
1. Afghanistan men's internationals are withheld
Cricsheet withholds matches involving the Afghanistan men's team (and the Afghanistan Premier League) by policy. Each archive's README records how many:
Matches withheld (each archive's README): {'tests_male': 14, 'odis_male': 162, 't20s_male': 166, 'it20s_male': 10}
tests_male: matches involving 'Afghanistan' = 0
odis_male: matches involving 'Afghanistan' = 0
t20s_male: matches involving 'Afghanistan' = 0
it20s_male: matches involving 'Afghanistan' = 0
t20s_female: matches involving 'Afghanistan' = 0
odis_female: matches involving 'Afghanistan' = 0
Afghan players — Rashid Khan, Noor Ahmad, Mujeeb Ur Rahman, Rahmanullah Gurbaz, Mohammad Nabi — appear only through franchise leagues. Never present an international or "career" figure for an Afghan player from this data; say "in the franchise leagues in the data". Any "all men's T20Is" or "all ODIs" baseline is missing Afghanistan's matches.
2. Names are not unique — use the ids
275 display names in the register belong to more than one person; 68 names map to two or more people
within a single competition's ball-by-ball data and 127 across the snapshot. Every delivery carries
batter_id, bowler_id, non_striker_id and player_out_id, and not one is missing. Group by id,
or pin a player with only_player() (B.4, B.6.1).
3. No line, length, speed, shot direction or field positions
columns that look like tracking, line, length, shot, field position, day or session: []
Cricsheet records what happened on each ball, not how: no pitch location, line, length, ball speed, swing, spin, DRS ball-tracking projections, shot direction or shot type, fielding positions, dropped catches or misfields. Where a method needs those, the book uses the 🧪 simulated layer (B.6.3) and says what real tracking data would change. Catches, run-outs and stumpings — with the fielders' names — are real.
4. No player roles or batting positions
No column says "opener", "finisher", "wicketkeeper" or "all-rounder". Batting position is inferred
from order of entry (Crease's explore.batting_order, formats.entry_positions,
selection.entry_positions); wicketkeepers are inferred from stumpings and catches
(fielding.infer_keepers, Chapter 17); bowling type and batting hand come from
player_styles.csv (B.5).
5. No session or day labels in Tests
men's Tests n_days: {2: 9, 3: 137, 4: 284, 5: 468, 6: 1}
The matches table knows how many dates a Test spanned and when it started, but no delivery says which day or session it was bowled in. Chapter 29 builds a "pitch clock" from overs bowled in the match and checks its own day estimates (Chapter 29); treat any session label as an estimate.
6. No targets in Tests
Test deliveries with a target_runs value: 0
IPL innings-2 deliveries with target_runs: 142,303 of 142,303
Limited-overs second innings carry their target on every ball; Tests carry none. Compute a fourth-innings target from the innings totals: (sum of the opponent's two innings) − (the chasing side's first innings) + 1, after checking for follow-ons and declarations (Chapter 33).
7. Innings-level penalty runs are not on any delivery
men's Test innings with innings-level penalty_runs: 5; absent_hurt: 52; declared: 530
declared innings visible in the deliveries table: 530
deliveries with 2 wickets recorded, IPL / Tests: 0 / 1
Cricsheet records some penalty runs against an innings as a whole — awarded before or after it —
rather than on a delivery. The toolkit keeps the innings-level declared flag (all 530
declared Test innings are visible) but not penalty_runs or absent_hurt, so summing runs_total for
those five Test innings comes out a few runs short of the official total. Delivery-level penalties are
kept (penalty).
8. Smaller things that catch people out
| Gap or quirk | Effect | Handle it |
|---|---|---|
| Only the first of several wickets on a ball is kept | 13 deliveries in the snapshot | n_wickets_on_ball > 1 finds them |
| Substitute fielders, team sheets and Impact Player replacements | in the raw JSON, not in the flat tables | read the zips directly, as Chapter 17's fielding.load_xis does |
city missing |
51 IPL matches (Dubai, Sharjah); 10.9% of Tests | venues.host_country uses the venue name |
| Team renames | e.g. Delhi Daredevils → Delhi Capitals, Kings XI Punjab → Punjab Kings, Royal Challengers Bangalore → Bengaluru | map old names to new before multi-season team analysis |
| Coverage lapses | sma ends December 2024; it20s_male ends May 2024 |
check start_date.max() before assuming a season exists |
| Older matches | Cricsheet can differ from official records by a run or a match | say so when comparing with a famous official figure |
| No women's Tests | none in the snapshot | — |
| Retired out | counted as a dismissal by batting_summary (retired hurt / not out are not) |
B.2 |
B.9 The data folder, file by file
data/
├── raw/
│ ├── <code>_json.zip the 20 Cricsheet archives (one JSON file per match + README + LICENSE)
│ ├── people.csv the people register (B.4)
│ └── ipl_auction_wiki/ cached source pages for the auction table
├── processed/
│ ├── <code>_deliveries.parquet 42 columns (B.1.1)
│ └── <code>_matches.parquet 27 columns (B.1.2)
└── reference/
├── ipl_auction.csv + ipl_auction_SOURCES.md
├── player_styles.csv + player_styles_SOURCES.md (v3, 2,011 rows; live)
├── player_styles_sim_v1.csv (1,551 rows; frozen for the simulator)
├── player_styles_male.csv / _female.csv / _male_ext.csv / _recent_ext.csv (the merged parts)
└── _*.csv, _ipl_names.txt (working files)
Cricsheet's data is released under the Open Data Commons Attribution licence (ODC-By): you may use
and share it, including commercially, with attribution to Cricsheet. Keep the LICENSE.txt from each
archive with any copy you redistribute, and credit Cricsheet in anything you publish. The cache
(processed/) can be deleted at any time; the toolkit rebuilds it from the zips. The zips can be
re-downloaded; the reference tables cannot be regenerated without their source pages, so treat
data/reference/ as the one folder to back up.