Skip to main content
Race pace analysis is a common task in F1 data science. The analysis examines lap times over a long stint. The results show which driver is faster and how well each driver manages the tires. Race pace box plot of the top 5 finishers at the 2024 Abu Dhabi Grand Prix

Loading the Data

This example uses the 2024 Abu Dhabi Grand Prix. It loads the session with the polars lib and converts the laps to pandas for plotting.

Cleaning the Data

In a race, lap times can be skewed by:
  • Safety Car periods (very slow laps)
  • Pit stops (very slow laps)
  • Lap 1 (standing start)
Filter these laps out to get a “true” race pace. On the polars backend, LapTime is a Duration, and to_pandas() turns it into timedelta64[ns]. The code below uses the float LapTimeSeconds column, which compares and plots in seconds.

Comparing Drivers

Compare the race pace of two drivers.

Interpreting the Results

  • Median (line in the box): Represents the typical race pace.
  • Box size (IQR): Represents consistency. A smaller box means the driver was more consistent.
  • Whiskers/Outliers: Show variance caused by traffic or minor errors.

Visualizing Pace Over the Race

Plot lap times against lap numbers to see how the pace evolved (tire degradation).

Conclusion

Follow this workflow to:
  1. Load high-quality timing data.
  2. Clean it to remove anomalies.
  3. Compare drivers using statistical distributions.
  4. Visualize performance trends across the entire race.
Last modified on October 30, 2026