Skip to content

Commit

Permalink
FIX: Assign NaN position for drivers that crashed in Lap 1 (#595)
Browse files Browse the repository at this point in the history
fixes #569
  • Loading branch information
AND2797 authored Jun 11, 2024
1 parent 84500c9 commit 6cb68db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,13 @@ def _load_laps_data(self, livedata=None):
laps.loc[laps['LapNumber'] == lap_n, 'Position'] \
= laps_eq_n.sort_index()['Position'].to_list()

# assign NaN to drivers who crashed on lap 1
lap_counts = laps['Driver'].value_counts()
drivers_with_one_lap = lap_counts[lap_counts == 1].index
dnf_and_generated = (laps['FastF1Generated'] &
laps['Driver'].isin(drivers_with_one_lap))
laps.loc[dnf_and_generated, 'Position'] = np.NaN

self._add_track_status_to_laps(laps)

self._laps = Laps(laps, session=self, force_default_cols=True)
Expand Down

0 comments on commit 6cb68db

Please sign in to comment.