Case Study 2 — A Test Match in the Data: Bangladesh v Pakistan, Mirpur, May 2026
Format: Test (men's) · Data: Cricsheet match 1532486 · Code: code/case_study_02.py
Setup
Case Study 1 rebuilt a T20 final: two innings, 233 rows, one evening. A Test is a different animal — four innings, five days, two thousand deliveries, declarations, and no phases at all. The same toolkit handles both, but the questions you can ask, and the traps you can fall into, change with the format. Theme 2: three different sports.
Nusrat chose the match. "Mirpur," she said. "If I'm going to learn how Test data works, I want it to be a ground I've sat in." Shere Bangla National Stadium hosted the first Test of Pakistan's tour of Bangladesh, starting on 8 May 2026. Bangladesh won by 104 runs; Nazmul Hossain Shanto was player of the match.
The question for this case study: what does a Test look like in the flattened table, what is recorded only at innings level, and what does the toolkit keep and drop?
The data
First, the match row and the raw innings from the JSON:
Bangladesh v Pakistan, Shere Bangla National Stadium, Mirpur, start 2026-05-08, n_days=5
Toss: Pakistan chose to field. Result: Bangladesh won by 104 runs. Player of the match: Nazmul Hossain Shanto
info['dates']: ['2026-05-08', '2026-05-09', '2026-05-10', '2026-05-11', '2026-05-12']
raw innings 1: keys=['team', 'overs'], overs listed=118
raw innings 2: keys=['team', 'overs'], overs listed=101
raw innings 3: keys=['team', 'overs', 'declared'], overs listed=71
raw innings 4: keys=['team', 'overs'], overs listed=53
Three Test-specific features are already visible:
dateshas five entries, so the toolkit'sn_daysis 5. But notice what isn't there: no delivery says which day it was bowled on. Cricsheet's Test files record the dates of the match, not the day of each ball. Any "day 4 batting average" needs an approximation — Chapter 29 builds one from the over count.- Innings 3 carries a
declaredflag. The toolkit copies it onto every delivery of that innings as thedeclaredcolumn. - Pakistan won the toss and chose to field — and lost. One match proves nothing about that decision (Chapter 22 studies tosses across hundreds).
To keep memory low, the script reads only the 25 columns it needs from the Tests Parquet file (the full table is about 2 GB in memory — Chapter 2, §2.6) and then filters to this match:
t = pd.read_parquet(d_path, columns=cols)
t = t[t["match_id"] == TEST_ID].sort_values("delivery_seq")
Analysis
Four innings
Innings summary:
runs wickets legal extras declared fours sixes overs run_rate
innings batting_team
1 Bangladesh 413 10 703 37 False 45 4 117.1 3.52
2 Pakistan 386 10 603 25 False 47 2 100.3 3.84
3 Bangladesh 240 9 423 7 True 22 2 70.3 3.40
4 Pakistan 163 10 317 12 False 18 0 52.5 3.09
Legal balls in the match: 2,046; deliveries: 2,071; phase values present: ['none']
The innings read like a classic subcontinental Test. Bangladesh 413 and 240 for 9 declared; Pakistan 386 and 163. Bangladesh's first-innings lead was 27; they set Pakistan 268 to win (27 + 240 + 1) and bowled them out for 163 in 52.5 overs.
A T20 innings is at most 120 legal balls. Bangladesh's first innings alone was 703. The whole match was 2,046 legal balls — almost nine T20 matches' worth, and close to the median Test (1,949 legal balls, Chapter 2, §2.8). Run rates of 3.1–3.8 an over belong to a different sport from the IPL's 9.9.
And the phase column contains only "none": there is no powerplay in a Test. Every phase-based
tool you'll build for T20 and ODI cricket must be swapped for something else here — innings number,
overs into the innings, the age of the ball.

📊 Figure (described): Four lines show the running score of each innings against overs into that innings, with dots at each wicket: Bangladesh 413 all out in 117.1 overs, Pakistan 386 in 100.3, Bangladesh 240 for 9 declared in 70.3, Pakistan 163 in 52.5. The first two innings track each other closely for 80 overs; the fourth innings flattens after about 45 overs as wickets fall in a cluster. The takeaway: a Test is won over hundreds of balls, and a worm chart shows where the innings diverged.
The performers
Top two scorers in each innings:
innings_no batting_team batter runs balls strike_rate outs
1 Bangladesh Nazmul Hossain Shanto 101 130 77.69 1
1 Bangladesh Mominul Haque 91 200 45.50 1
2 Pakistan Azan Awais 103 165 62.42 1
2 Pakistan Abdullah Fazal 60 120 50.00 1
3 Bangladesh Nazmul Hossain Shanto 87 150 58.00 1
3 Bangladesh Mominul Haque 56 120 46.67 1
4 Pakistan Abdullah Fazal 66 113 58.41 1
4 Pakistan Agha Salman 26 39 66.67 1
Shanto made 101 and 87 — 188 runs in the match — which explains the player-of-the-match award. Mominul Haque made 91 and 56 at strike rates in the forties: classic Test accumulation, the kind of innings a T20-trained eye undervalues. Chapter 10 builds the metrics that measure it properly — balls per dismissal, conversion — rather than judging Test batting by strike rate.
Bowlers with 4+ wickets in the match:
overs runs wickets economy average dot_pct
bowling_team bowler
Bangladesh Mehedi Hasan Miraz 55.0 149 6 2.71 24.83 72.73
Nahid Rana 30.5 144 6 4.67 24.00 67.03
Pakistan Mohammad Abbas 48.0 127 6 2.65 21.17 79.17
Shaheen Shah Afridi 47.1 167 5 3.54 33.40 74.20
Hasan Ali 43.3 127 4 2.92 31.75 75.48
Bangladesh Taijul Islam 25.3 68 4 2.67 17.00 75.16
Pakistan Nauman Ali 38.0 156 4 4.11 39.00 58.33
Bangladesh Taskin Ahmed 28.0 110 4 3.93 27.50 72.02
Dismissal kinds in the match: {'caught': 25, 'lbw': 9, 'bowled': 5}
Bangladesh's twenty wickets came from four bowlers: Mehedi Hasan Miraz 6, Nahid Rana 6, Taijul Islam 4, Taskin Ahmed 4 — two spinners and two quicks, ten wickets each way. Nahid Rana's 6 came at 4.67 an over, expensive by Test standards; Mehedi's at 2.71. Two bowlers with the same wicket count and very different methods — the Test version of the Rabada–Kumar contrast in the chapter's IPL table.
Nine of the match's 39 dismissals were lbw (23%) — above the 16.6% lbw share for all men's Tests in the Chapter 2 snapshot, and far above the IPL's 6.0%. One match is a small sample, but it's the kind of number that makes you want to check Mirpur's lbw rate over many Tests.
One line per batter per innings
The scorer's view of a Test lists each innings separately, so the script groups by innings as well as batter:
bat = batting_summary(t, by=["innings", "batting_team", "batter"])
# the result has an `innings` COUNT column too, so name the index level differently before reset_index
bat.index = bat.index.set_names(["innings_no", "batting_team", "batter"])
The second line is a small piece of pandas housekeeping, not a toolkit problem: the summary already
has a column called innings (the count of innings played), and reset_index() refuses to create a
second column with the same name. Renaming the index level to innings_no keeps the two apart. With
a single match and a single innings per row, that count is always 1 — which is a useful check that the
grouping did what you meant.
What the innings level holds — and the toolkit drops
The script then scans every innings in every Test file in the snapshot for innings-level keys:
Innings-level keys in all 3341 Test innings: {'team': 3341, 'overs': 3341, 'declared': 530, 'penalty_runs': 5, 'miscounted_overs': 105, 'absent_hurt': 52}
first example of 'penalty_runs': match 1030217, innings 2: {'pre': 5}
first example of 'miscounted_overs': match 1034811, innings 4: {'46': {'balls': 5, 'umpire': 'RJ Tucker'}}
first example of 'absent_hurt': match 1109602, innings 2: ['DAS Gunaratne']
| Innings-level key | Innings with it | Kept by the toolkit? | Consequence |
|---|---|---|---|
declared |
530 | Yes — the declared column |
You can find every declaration |
miscounted_overs |
105 | No | Cricsheet even records which umpire miscounted (an over of 5 balls in the example). The toolkit's legal-ball counts are still right, because it counts balls rather than trusting over numbers. |
absent_hurt |
52 | No | A team "all out" for 9 wickets may have had a batter absent hurt; the 10-wicket assumption fails |
penalty_runs |
5 | No | Five penalty runs awarded before an innings ("pre") are not on any delivery, so summing runs_total gives a total 5 short of the official one |
The penalty_runs row is the one that bites. In those five innings the toolkit's innings total — the
sum over deliveries — will differ from the official scorecard by the penalty. It's rare (5 of 3,341
innings) and it's exactly the kind of difference the chapter's audit checklist is designed to catch:
when your total disagrees with the published one, look for innings-level adjustments before you
suspect your code.
What it means (and doesn't)
The same toolkit, a different sport. The ball-by-ball table handled a five-day Test exactly as it handled a three-hour final: one row per delivery, legal balls counted, wickets attributed. But the analysis had to change. No phases. Strike rate secondary to survival. Twenty wickets, not ten. A declaration that changes what "all out" means.
What we can't see. Which day each ball was bowled on; the pitch's condition on day five; the weather; the ball's age except by counting overs since the last new ball (which itself isn't recorded directly). Imran Qureshi, who runs the analytics for Headingley Road CC in Leeds, would add the obvious: "In Test cricket the ball and the pitch are half the story, and neither is in this file."
One match is an anecdote. Shanto's 188 runs, Mehedi's six wickets, nine lbws — none of these is evidence of anything general. They are the kind of observation that motivates a proper study across many matches.
Discussion questions
- The
phasecolumn is"none"for every Test delivery. Propose two ways to divide a Test innings into "phases" using only columns in the toolkit's table. What would each capture, and what would it miss? - Bangladesh declared at 240 for 9, setting 268. Was the declaration aggressive or cautious? What information that isn't in Cricsheet would you want before judging? (Chapter 33 builds a declaration model.)
- Mominul Haque's 91 came at a strike rate of 45.50. In what sense is that a better innings than a 91 at 150 would be in a Test? In what sense might it be worse?
- The toolkit keeps
declaredbut dropsabsent_hurt. Which later analyses could that choice distort, and how would you detect it?
Your turn
Repeat this analysis for a women's ODI — a different format and gender. Use
load_matches("odis_female") to pick a recent match (for example, the India v Zimbabwe series in
October 2026 that closes the snapshot), adapt code/case_study_02.py (change the archive to
odis_female_json.zip and the Parquet file to odis_female_deliveries.parquet), and produce the
innings summary, the top scorers and bowlers, the phase splits (ODIs do have phases: 1–10, 11–40,
41–50) and a worm chart. Then scan every innings in the women's ODI archive for innings-level keys,
as above, and report which ones occur and how often.