Skip to content

Commit

Permalink
FIX: prevent setting timedelta on datetime array (#676)
Browse files Browse the repository at this point in the history
See #674 for discussion

---------

Co-authored-by: theOehrly <23384863+theOehrly@users.noreply.github.com>
  • Loading branch information
Casper-Guo and theOehrly authored Jan 18, 2025
1 parent aa69f90 commit 5e22316
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,8 @@ def _load_laps_data(self, livedata=None):
laps_start_time.insert(0, self.session_start_time)
else:
laps_start_time.insert(0, pd.NaT)
laps_start_time = pd.Series(laps_start_time)
laps_start_time = pd.Series(laps_start_time,
dtype="timedelta64[ns]")

# don't set lap start times after red flag restart to the time
# at which the previous lap was set
Expand Down Expand Up @@ -1590,9 +1591,7 @@ def _load_laps_data(self, livedata=None):
elif row['Status'] == 'Aborted': # red flag
_is_aborted = True

result.loc[:, 'LapStartTime'] = pd.Series(
laps_start_time, dtype='timedelta64[ns]'
)
result['LapStartTime'] = laps_start_time

# set missing lap start times to pit out time, where possible
mask = (pd.isna(result['LapStartTime'])
Expand Down

0 comments on commit 5e22316

Please sign in to comment.