Best Recorded Time per Runner
Problem
You are given a DataFrame `race_log` with columns `athlete_id`, `given_name`, `family_name`, `finish_seconds`, and `club_code`. It may contain several rows for the same athlete, one per race they entered. A higher `finish_seconds` value means a stronger result on this leaderboard (it is a cumulative points-per-second score, not a clock time).
For every athlete, report their best (highest) `finish_seconds` value. Output the athlete's id, given name, family name, that best score (keep the column named `finish_seconds`), and their club code, ordered by `athlete_id`.
Input data
Example rows — the live problem includes the full dataset.
| athlete_id | given_name | family_name | finish_seconds | club_code |
|---|---|---|---|---|
| 1 | Mira | Okonjo | 4120 | C90 |
| 1 | Mira | Okonjo | 4500 | C90 |
| 2 | Bao | Liang | 3890 | C71 |
| 2 | Bao | Liang | 4010 | C71 |
| 3 | Petra | Vasco | 5200 | C90 |
Expected output
Your answer should return 3 rows with the columns athlete_id, given_name, family_name, finish_seconds, club_code.
Starter code (Pandas (Python))
import pandas as pd
def best_recorded_time_per_runner(race_log) -> pd.DataFrame:
# Your code here
return race_logSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock