Draichi commited on
Commit
265fb29
1 Parent(s): 8408558

fix(formula1_databases): session start and Laps datetime

Browse files
Files changed (1) hide show
  1. notebooks/formula1_databases.py +5 -5
notebooks/formula1_databases.py CHANGED
@@ -141,7 +141,7 @@ class FastF1ToSQL:
141
  session.load()
142
 
143
  # Save session start date
144
- self._session_start_date = session.session_info['StartDate']
145
 
146
  # Insert data into tables
147
  self.insert_event(session)
@@ -237,10 +237,10 @@ class FastF1ToSQL:
237
  laps_df['session_id'] = self.cursor.lastrowid
238
  laps_df['lap_start_time_in_datetime'] = pd.to_datetime(
239
  laps_df['LapStartDate'])
240
- laps_df['pin_in_time_in_datetime'] = pd.to_datetime(
241
- laps_df['PitInTime'], unit='ns')
242
- laps_df['pin_out_time_in_datetime'] = pd.to_datetime(
243
- laps_df['PitOutTime'], unit='ns')
244
 
245
  for _, lap in laps_df.iterrows():
246
  lap_data: dict[str, Any] = {
 
141
  session.load()
142
 
143
  # Save session start date
144
+ self._session_start_date = session.t0_date
145
 
146
  # Insert data into tables
147
  self.insert_event(session)
 
237
  laps_df['session_id'] = self.cursor.lastrowid
238
  laps_df['lap_start_time_in_datetime'] = pd.to_datetime(
239
  laps_df['LapStartDate'])
240
+ laps_df['pin_in_time_in_datetime'] = self._session_start_date + \
241
+ laps_df['PitInTime']
242
+ laps_df['pin_out_time_in_datetime'] = self._session_start_date + \
243
+ laps_df['PitOutTime']
244
 
245
  for _, lap in laps_df.iterrows():
246
  lap_data: dict[str, Any] = {