Skip to content

Commit

Permalink
Fix setting timedelta on datetime array
Browse files Browse the repository at this point in the history
See #674 for discussion
  • Loading branch information
Casper-Guo committed Jan 17, 2025
1 parent 976efb3 commit 801c23f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ 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 +1590,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 801c23f

Please sign in to comment.