apopt.comCBE 493R Data-Driven Athletics

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.

  1. 1Gather (used)
  2. 2Statistics
  3. 3Visualize (used)
  4. 4Cleanse
  5. 5Features
  6. 6Balance
  7. 7Scale
  8. 8Split
  9. 9Deploy
  1. Ask
  2. Collect (this week)
  3. Check (this week)
  4. Interpret
  5. Coach
  6. Reassess

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

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.

PythonType the sheet

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.5

Add 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.

PythonCompute two columns and check against the file

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      80

Every 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

PythonHeart rate through the test

Type a prediction to enable Run.

Show the expected result without running
highest 124 bpm; first recovery count 88 bpm
Heart rate in beats per minute against time in minutes. Filled circles for the three stages rise from 96 to 124 bpm; open squares for the five recovery counts fall from 88 to 76 and level off.

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

  1. A 15-second count of 27 beats is what heart rate?

    beats/min

  2. Why check the typed table against the file with assert, instead of looking at it?

0 of 2 answered · 0 right the first time

References

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.