theOehrly / Fast-F1

FastF1 is a python package for accessing and analyzing Formula 1 results, schedules, timing data and telemetry
https://docs.fastf1.dev
MIT License
2.29k stars 239 forks source link

Fix-569: set Laptime to NaT for drivers crashed in lap 1. Assign NaN position. #586

Closed AND2797 closed 1 month ago

AND2797 commented 1 month ago

There is a special case in _load_laps_data to create data for drivers crashed in lap1. In that, previously we were assigning data['Time'].min() this was the source of the bug.

I modified two things: assign time as pd.NaT for crashed drivers.

And while generating the position of drivers for the lap, assign np.NaN to drivers who have NaT/NaN times.

AND2797 commented 1 month ago

I'll take a look at the failing tests.

theOehrly commented 1 month ago

The chained [...][...] write access is probably responsible for the Pandas warning.

I'm also not sure if we can really set 'Time' to NaT. That might break getting telemetry data for the crash laps (and I'm not sure if there's a test for that). But we might need to leave the 'Time' as it is and only detect based on 'LapTime' being NaT and maybe this being the last lap of that driver.