Course / Tutorials / Week 2 / Q-4
Quick tutorial Q-4 · Week 2 · about 15 min · Foundation
Type a small table and plot it
Type a step test's paper sheet into a pandas table, add heart rate and lifting power, check every value against the file with assert, and draw one chart of heart rate through the test.
- Ask
- Collect (this week)
- Check (this week)
- Interpret
- Coach
- Reassess
Download notebook ·Python file ·Read as Markdown ·Data folder ·Chapter 2 (sections 2.11, 2.12)
Every cell runs in this page; the first run downloads Python (about 30 s). Nothing you load leaves your browser. Helpful first: Q-1 Run your first cell and change one number.
The decision
A partner hands you a paper sheet of pulse counts from a step test. Before anyone reads a trend from it, turn it into a table you have checked, with the units written in the column names.
The raw data
raw/steptest_counts.csv: the same sheet as a file, eight 15-second pulse counts from a three-stage step test and five minutes of recovery (synthetic). Data-Driven Athletics, Chapter 2, Section 2.11: Sam's step test, synthetic data made by the chapter's script so the true answers are known.
Try it
A paper sheet becomes a table
In the step test of Section 2.11, a partner writes on paper: the stage, the metronome's step rate, and the number of beats counted in 15 seconds after each stage and at each minute of recovery. Here is Sam's sheet. Sam is a made-up student; the numbers are the book's synthetic step test, made by a script so that the true answers are known.
Type the sheet into Python as a table (a pandas DataFrame): one row per count, one column per thing written down. Typing it is the raw record; nothing is computed yet.
Type a prediction to enable Run.
Show the expected result without running
(8, 4)
label rate_cpm count15 t_mid_s
stage 1 15 24 309.5
stage 2 20 27 509.5
stage 3 25 31 709.5
recovery 1 min 0 22 767.5
recovery 2 min 0 21 827.5
recovery 3 min 0 19 887.5
recovery 4 min 0 19 947.5
recovery 5 min 0 20 1007.5Add the columns you compute, and check what you typed
Two columns come from arithmetic. A 15-second count times four is beats a minute. The power spent lifting the body is m g h times cycles a second: Sam weighs 70 kg and the bench is 0.30 m. Then compare your table with the book's file of the same sheet. A typing error shows up here, not three weeks later in a chart.
Show the expected result without running
typed table matches the file in every checked column
label power_W hr_bpm
stage 1 51.5 96
stage 2 68.7 108
stage 3 85.8 124
recovery 1 min 0.0 88
recovery 2 min 0.0 84
recovery 3 min 0.0 76
recovery 4 min 0.0 76
recovery 5 min 0.0 80Every value matches. Change one count above (type 32 for stage 3, say) and run both cells again: the assert stops with the name of the column that differs.
One chart
Type a prediction to enable Run.
Show the expected result without running
highest 124 bpm; first recovery count 88 bpm

Heart rate climbs with each stage and falls quickly once Sam stops: 124 after stage 3, 88 one minute later. Every value is a multiple of four, because a 15-second count can only move in steps of four beats a minute (Section 2.12).
For the athlete: "Your heart rate rose evenly with each step rate and was back under 90 within a minute of stopping; we'll repeat the same sheet in six weeks and compare."
With your own data
Run the step test of Chapter 2's field exercise with a partner, type your own sheet into the first cell with your body mass and bench height, and draw the same chart. Heart rate is personal: keep the file to yourself unless you choose to share it.
Check yourself
A 15-second count of 27 beats is what heart rate?
Why check the typed table against the file with assert, instead of looking at it?
References
- Data-Driven Athletics, Chapter 2, Measuring Yourself: A Step Test (Section 2.11) and How Good Is the Number? (Section 2.12).
Built 2026-11-30 with Python packages numpy 2.5.5, pandas 3.1.1, matplotlib 3.11.2. In the browser the same code runs on Pyodide, so the last digit can differ.