diff --git "a/notebooks/save_data_database.ipynb" "b/notebooks/save_data_database.ipynb" --- "a/notebooks/save_data_database.ipynb" +++ "b/notebooks/save_data_database.ipynb" @@ -1 +1 @@ -{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Save fastf1 data a to SQL database\n","\n","Useful for generating quick reports during the race.\n"]},{"cell_type":"code","execution_count":1,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":["req WARNING \tDEFAULT CACHE ENABLED! (1.04 GB) /Users/diegomaradona/Library/Caches/fastf1\n","core INFO \tLoading data for Spanish Grand Prix - Practice 1 [v3.3.3]\n","req INFO \tUsing cached data for session_info\n","req INFO \tUsing cached data for driver_info\n","req INFO \tUsing cached data for session_status_data\n","req INFO \tUsing cached data for track_status_data\n","req INFO \tUsing cached data for _extended_timing_data\n","req INFO \tUsing cached data for timing_app_data\n","core INFO \tProcessing timing data...\n","core WARNING \tNo lap data for driver 27\n","core WARNING \tFailed to perform lap accuracy check - all laps marked as inaccurate (driver 27)\n","req INFO \tUsing cached data for car_data\n","req INFO \tUsing cached data for position_data\n","core INFO \tFinished loading data for 21 drivers: ['1', '10', '11', '14', '16', '18', '2', '20', '22', '23', '24', '27', '3', '31', '4', '44', '50', '55', '63', '77', '81']\n"]}],"source":["import fastf1\n","\n","GRAND_PRIX = 'Spain'\n","YEAR = 2024\n","DRIVER = 'HAM'\n","SESSION = 'FP1'\n","\n","session = fastf1.get_session(YEAR, GRAND_PRIX, SESSION)\n","session.load(weather=False, messages=False)"]},{"cell_type":"code","execution_count":2,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["df len: 59\n"]},{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
TimeDriverDriverNumberLapTimeLapNumberStintPitOutTimePitInTimeSector1TimeSector2Time...FreshTyreTeamLapStartTimeLapStartDateTrackStatusPositionDeletedDeletedReasonFastF1GeneratedIsAccurate
3680 days 00:16:01.111000HAM44NaT11.00 days 00:14:15.834000NaTNaT0 days 00:00:35.817000...TrueMercedes0 days 00:14:15.8340002024-06-21 11:30:16.2801NaNNoneFalseFalse
4560 days 00:15:55.553000RUS63NaT11.00 days 00:14:18.199000NaTNaT0 days 00:00:37.699000...TrueMercedes0 days 00:14:18.1990002024-06-21 11:30:18.6451NaNNoneFalseFalse
4570 days 00:17:12.577000RUS630 days 00:01:17.02400021.0NaTNaT0 days 00:00:22.7130000 days 00:00:30.820000...TrueMercedes0 days 00:15:55.5530002024-06-21 11:31:55.9991NaNNoneFalseTrue
3690 days 00:17:18.743000HAM440 days 00:01:17.63200021.0NaTNaT0 days 00:00:22.8150000 days 00:00:31.375000...TrueMercedes0 days 00:16:01.1110002024-06-21 11:32:01.5571NaNNoneFalseTrue
4580 days 00:19:24.680000RUS630 days 00:02:12.10300031.0NaTNaT0 days 00:00:38.5420000 days 00:00:57.766000...TrueMercedes0 days 00:17:12.5770002024-06-21 11:33:13.0231NaNNoneFalseTrue
\n","

5 rows × 31 columns

\n","
"],"text/plain":[" Time Driver DriverNumber LapTime \\\n","368 0 days 00:16:01.111000 HAM 44 NaT \n","456 0 days 00:15:55.553000 RUS 63 NaT \n","457 0 days 00:17:12.577000 RUS 63 0 days 00:01:17.024000 \n","369 0 days 00:17:18.743000 HAM 44 0 days 00:01:17.632000 \n","458 0 days 00:19:24.680000 RUS 63 0 days 00:02:12.103000 \n","\n"," LapNumber Stint PitOutTime PitInTime Sector1Time \\\n","368 1 1.0 0 days 00:14:15.834000 NaT NaT \n","456 1 1.0 0 days 00:14:18.199000 NaT NaT \n","457 2 1.0 NaT NaT 0 days 00:00:22.713000 \n","369 2 1.0 NaT NaT 0 days 00:00:22.815000 \n","458 3 1.0 NaT NaT 0 days 00:00:38.542000 \n","\n"," Sector2Time ... FreshTyre Team LapStartTime \\\n","368 0 days 00:00:35.817000 ... True Mercedes 0 days 00:14:15.834000 \n","456 0 days 00:00:37.699000 ... True Mercedes 0 days 00:14:18.199000 \n","457 0 days 00:00:30.820000 ... True Mercedes 0 days 00:15:55.553000 \n","369 0 days 00:00:31.375000 ... True Mercedes 0 days 00:16:01.111000 \n","458 0 days 00:00:57.766000 ... True Mercedes 0 days 00:17:12.577000 \n","\n"," LapStartDate TrackStatus Position Deleted DeletedReason \\\n","368 2024-06-21 11:30:16.280 1 NaN None \n","456 2024-06-21 11:30:18.645 1 NaN None \n","457 2024-06-21 11:31:55.999 1 NaN None \n","369 2024-06-21 11:32:01.557 1 NaN None \n","458 2024-06-21 11:33:13.023 1 NaN None \n","\n"," FastF1Generated IsAccurate \n","368 False False \n","456 False False \n","457 False True \n","369 False True \n","458 False True \n","\n","[5 rows x 31 columns]"]},"execution_count":2,"metadata":{},"output_type":"execute_result"}],"source":["df = session.laps.pick_team('Mercedes')\n","df = df[df['Deleted'].isna()]\n","df['LapNumber'] = df['LapNumber'].astype(int)\n","df = df.sort_values(by='LapNumber')\n","print(f\"df len: {len(df)}\")\n","df.head()"]},{"cell_type":"markdown","metadata":{},"source":["#### Convert time columns to seconds\n"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["Converted LapTime to seconds.\n","Converted PitOutTime to seconds.\n","Converted PitInTime to seconds.\n","Converted Sector1Time to seconds.\n","Converted Sector2Time to seconds.\n","Converted Sector3Time to seconds.\n","Converted LapStartTime to seconds.\n"]},{"data":{"text/plain":["Index(['Time', 'Driver', 'DriverNumber', 'LapNumber', 'Stint', 'SpeedI1',\n"," 'SpeedI2', 'SpeedFL', 'SpeedST', 'IsPersonalBest', 'Compound',\n"," 'TyreLife', 'FreshTyre', 'Team', 'LapStartDate', 'TrackStatus',\n"," 'Position', 'Deleted', 'DeletedReason', 'FastF1Generated', 'IsAccurate',\n"," 'LapTimeSeconds', 'PitOutTimeSeconds', 'PitInTimeSeconds',\n"," 'Sector1TimeSeconds', 'Sector2TimeSeconds', 'Sector3TimeSeconds',\n"," 'LapStartTimeSeconds'],\n"," dtype='object')"]},"execution_count":3,"metadata":{},"output_type":"execute_result"}],"source":["time_columns = ['LapTime', 'PitOutTime', 'PitInTime',\n"," 'Sector1Time', 'Sector2Time', 'Sector3Time', 'LapStartTime']\n","for col in time_columns:\n"," if col in df.columns:\n"," df[col + 'Seconds'] = df[col].dt.total_seconds()\n"," df.drop(columns=[col], inplace=True, axis=1)\n"," print(f\"Converted {col} to seconds.\")\n","\n","df.drop(columns=[col for col in ['Sector1SessionTime', 'Sector2SessionTime',\n"," 'Sector3SessionTime'] if col in df.columns], inplace=True, axis=1)\n","df.columns"]},{"cell_type":"code","execution_count":4,"metadata":{},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
DriverDriverNumberLapNumberStintSpeedI1SpeedI2SpeedFLSpeedSTIsPersonalBestCompound...FastF1GeneratedIsAccurateLapTimeSecondsPitOutTimeSecondsPitInTimeSecondsSector1TimeSecondsSector2TimeSecondsSector3TimeSecondsLapStartTimeSecondsTimeInMinutes
368HAM4411.0215.0220.0281.0207.0FalseHARD...FalseFalseNaN855.834NaNNaN35.81724.869855.83416.018517
456RUS6311.0208.079.0282.0241.0FalseHARD...FalseFalseNaN858.199NaNNaN37.69933.034858.19915.925883
457RUS6321.0275.0292.0285.0316.0TrueHARD...FalseTrue77.024NaNNaN22.71330.82023.491955.55317.209617
369HAM4421.0287.0287.0282.0316.0TrueHARD...FalseTrue77.632NaNNaN22.81531.37523.442961.11117.312383
458RUS6331.0128.0152.0280.0258.0FalseHARD...FalseTrue132.103NaNNaN38.54257.76635.7951032.57719.411333
370HAM4431.0124.0127.0NaN252.0FalseHARD...FalseFalse138.480NaN1174.54034.77660.31343.3911038.74319.620383
459RUS6341.0282.0291.0282.0318.0TrueHARD...FalseTrue75.868NaNNaN22.48530.53722.8461164.68020.675800
371HAM4442.0162.0209.0280.0149.0FalseHARD...FalseFalse138.9691202.155NaN60.71846.94031.3111177.22321.936533
460RUS6351.0178.0220.0NaN276.0FalseHARD...FalseFalse114.638NaN1352.48532.70846.24435.6861240.54822.586433
372HAM4452.0288.0301.0280.0318.0TrueHARD...FalseTrue76.650NaNNaN22.56330.89023.1971316.19223.214033
461RUS6362.0158.0193.0280.0144.0FalseHARD...FalseFalse148.3241387.823NaN71.10345.84031.3811355.18625.058500
373HAM4462.0125.0110.0282.0262.0FalseHARD...FalseTrue134.917NaNNaN38.00763.46933.4411392.84225.462650
462RUS6372.0288.0297.0284.0313.0TrueHARD...FalseTrue75.692NaNNaN22.38130.51222.7991503.51026.320033
374HAM4472.0288.0303.0281.0315.0TrueHARD...FalseTrue76.203NaNNaN22.47630.86322.8641527.75926.732700
463RUS6382.0132.0190.0190.0150.0FalseHARD...FalseTrue140.851NaNNaN42.61161.34536.8951579.20228.667550
375HAM4482.0102.0132.0280.0298.0FalseHARD...FalseTrue142.788NaNNaN37.93871.92132.9291603.96229.112500
464RUS6392.0179.0233.0281.0277.0FalseHARD...FalseTrue111.772NaNNaN32.08845.57734.1071720.05330.530417
376HAM4492.0288.0307.0281.0316.0TrueHARD...FalseTrue76.079NaNNaN22.38130.71922.9791746.75030.380483
377HAM44102.0174.0230.0NaN258.0FalseHARD...FalseFalse98.026NaN1918.27531.47538.16528.3861822.82932.014250
465RUS63102.0287.0299.0283.0315.0TrueHARD...FalseTrue75.563NaNNaN22.37030.35122.8421831.82531.789800
378HAM44113.0206.0151.0283.0202.0FalseMEDIUM...FalseFalseNaN2539.519NaNNaN41.52426.3221920.85543.966183
466RUS63112.0179.0237.0NaN240.0FalseHARD...FalseFalse100.057NaN2004.75828.92740.11031.0201907.38833.457417
467RUS63123.0224.0243.0281.0157.0FalseMEDIUM...FalseFalseNaN2485.373NaNNaN40.20627.9632007.44543.125483
379HAM44123.0289.0309.0284.0320.0TrueMEDIUM...FalseTrue74.911NaNNaN22.04930.00522.8572637.97145.214700
468RUS63133.0285.0306.0283.0311.0TrueMEDIUM...FalseTrue74.753NaNNaN22.30029.88922.5642587.52944.371367
380HAM44133.0119.0154.0NaN301.0FalseMEDIUM...FalseFalse146.607NaN2856.77738.13963.43145.0372712.88247.658150
469RUS63143.0138.0150.0151.0137.0FalseMEDIUM...FalseTrue146.632NaNNaN44.35857.19145.0832662.28246.815233
381HAM44144.0112.0205.0283.0126.0FalseMEDIUM...FalseFalseNaN2886.274NaN74.77658.75729.3662859.48950.377317
470RUS63153.0118.097.0281.0198.0FalseMEDIUM...FalseTrue135.035NaNNaN43.91757.05434.0642808.91449.065817
382HAM44154.0289.0226.0NaN316.0FalseMEDIUM...FalseFalseNaNNaN3103.83822.20230.614NaN3022.63959.481067
471RUS63163.0289.0308.0281.0313.0TrueMEDIUM...FalseTrue74.614NaNNaN22.21229.90322.4992943.94950.309383
383HAM44165.0268.0157.0272.0235.0FalseMEDIUM...FalseFalseNaN3568.864NaNNaN33.91431.0053568.86461.247617
384HAM44175.0269.0264.0273.0295.0FalseMEDIUM...FalseTrue80.300NaNNaN24.16932.19023.9413674.85762.585950
472RUS63173.0163.094.0NaN177.0FalseMEDIUM...FalseFalseNaNNaN3143.25635.42948.110NaN3018.56358.147183
473RUS63184.0256.0268.0269.0230.0FalseHARD...FalseFalseNaN3488.831NaNNaN33.34427.1293488.83159.932850
385HAM44185.0271.0272.0274.0302.0FalseMEDIUM...FalseTrue79.933NaNNaN23.62732.17324.1333755.15763.918167
474RUS63194.0272.0276.0274.0289.0FalseHARD...FalseTrue80.780NaNNaN24.28932.26524.2263595.97161.279183
386HAM44195.0275.0270.0278.0304.0FalseMEDIUM...FalseTrue80.114NaNNaN23.76932.24224.1033835.09065.253400
387HAM44205.0276.0270.0278.0307.0FalseMEDIUM...FalseTrue80.399NaNNaN23.79132.41424.1943915.20466.593383
475RUS63204.0273.0255.0273.0298.0FalseHARD...FalseTrue83.024NaNNaN23.96332.48026.5813676.75162.662917
388HAM44215.0273.0160.0275.0NaNFalseMEDIUM...FalseTrue84.782NaNNaN23.72234.07426.9863995.60368.006417
476RUS63214.0268.0274.0275.0301.0FalseHARD...FalseTrue81.062NaNNaN24.06132.57324.4283759.77564.013950
389HAM44225.0NaN268.0275.0303.0FalseMEDIUM...FalseTrue80.692NaNNaN23.63832.75024.3044080.38569.351283
477RUS63224.0272.0272.0277.0303.0FalseHARD...FalseTrue80.558NaNNaN23.96032.35424.2443840.83765.356583
390HAM44235.0275.0274.0273.0301.0FalseMEDIUM...FalseTrue81.582NaNNaN23.76432.57625.2424161.07770.710983
478RUS63234.0276.0271.0NaN304.0FalseHARD...FalseFalse85.125NaN4003.71923.78332.78628.5563921.39566.775333
391HAM44245.0278.0275.0275.0302.0FalseMEDIUM...FalseTrue81.299NaNNaN24.06132.75824.4804242.65972.065967
479RUS63245.0270.0269.0277.0249.0FalseHARD...FalseFalse106.5744030.111NaN49.03933.22324.3124006.52068.551567
480RUS63255.0274.0277.0277.0298.0FalseHARD...FalseTrue81.085NaNNaN23.90232.78724.3964113.09469.902983
392HAM44255.0269.0247.0278.0303.0FalseMEDIUM...FalseTrue84.346NaNNaN24.49433.21426.6384323.95873.471733
393HAM44265.0276.0279.0275.0324.0FalseMEDIUM...FalseTrue80.920NaNNaN23.75132.74424.4254408.30474.820400
481RUS63265.0270.0282.0278.0300.0FalseHARD...FalseTrue80.941NaNNaN23.98932.52524.4274194.17971.252000
394HAM44275.0148.0133.015.0284.0FalseMEDIUM...FalseTrue137.310NaNNaN33.22451.29752.7894489.22477.108900
482RUS63275.0266.0280.0277.0321.0FalseHARD...FalseTrue81.028NaNNaN23.74932.77024.5094275.12072.602467
483RUS63285.0268.0278.0280.0303.0FalseHARD...FalseTrue81.183NaNNaN23.87032.86324.4504356.14873.955517
395HAM44285.0261.0270.0NaN273.0FalseMEDIUM...FalseFalse122.684NaN4746.48758.09035.91928.6754626.53479.153633
484RUS63295.0267.0269.0275.0324.0FalseHARD...FalseTrue81.520NaNNaN23.45433.25924.8074437.33175.314183
485RUS63305.0165.0150.039.0208.0FalseHARD...FalseTrue129.533NaNNaN33.10745.71850.7084518.85177.473067
486RUS63315.0255.0249.0NaN281.0FalseHARD...FalseFalse133.368NaN4778.93756.73246.63829.9984648.38479.695867
\n","

59 rows × 28 columns

\n","
"],"text/plain":[" Driver DriverNumber LapNumber Stint SpeedI1 SpeedI2 SpeedFL SpeedST \\\n","368 HAM 44 1 1.0 215.0 220.0 281.0 207.0 \n","456 RUS 63 1 1.0 208.0 79.0 282.0 241.0 \n","457 RUS 63 2 1.0 275.0 292.0 285.0 316.0 \n","369 HAM 44 2 1.0 287.0 287.0 282.0 316.0 \n","458 RUS 63 3 1.0 128.0 152.0 280.0 258.0 \n","370 HAM 44 3 1.0 124.0 127.0 NaN 252.0 \n","459 RUS 63 4 1.0 282.0 291.0 282.0 318.0 \n","371 HAM 44 4 2.0 162.0 209.0 280.0 149.0 \n","460 RUS 63 5 1.0 178.0 220.0 NaN 276.0 \n","372 HAM 44 5 2.0 288.0 301.0 280.0 318.0 \n","461 RUS 63 6 2.0 158.0 193.0 280.0 144.0 \n","373 HAM 44 6 2.0 125.0 110.0 282.0 262.0 \n","462 RUS 63 7 2.0 288.0 297.0 284.0 313.0 \n","374 HAM 44 7 2.0 288.0 303.0 281.0 315.0 \n","463 RUS 63 8 2.0 132.0 190.0 190.0 150.0 \n","375 HAM 44 8 2.0 102.0 132.0 280.0 298.0 \n","464 RUS 63 9 2.0 179.0 233.0 281.0 277.0 \n","376 HAM 44 9 2.0 288.0 307.0 281.0 316.0 \n","377 HAM 44 10 2.0 174.0 230.0 NaN 258.0 \n","465 RUS 63 10 2.0 287.0 299.0 283.0 315.0 \n","378 HAM 44 11 3.0 206.0 151.0 283.0 202.0 \n","466 RUS 63 11 2.0 179.0 237.0 NaN 240.0 \n","467 RUS 63 12 3.0 224.0 243.0 281.0 157.0 \n","379 HAM 44 12 3.0 289.0 309.0 284.0 320.0 \n","468 RUS 63 13 3.0 285.0 306.0 283.0 311.0 \n","380 HAM 44 13 3.0 119.0 154.0 NaN 301.0 \n","469 RUS 63 14 3.0 138.0 150.0 151.0 137.0 \n","381 HAM 44 14 4.0 112.0 205.0 283.0 126.0 \n","470 RUS 63 15 3.0 118.0 97.0 281.0 198.0 \n","382 HAM 44 15 4.0 289.0 226.0 NaN 316.0 \n","471 RUS 63 16 3.0 289.0 308.0 281.0 313.0 \n","383 HAM 44 16 5.0 268.0 157.0 272.0 235.0 \n","384 HAM 44 17 5.0 269.0 264.0 273.0 295.0 \n","472 RUS 63 17 3.0 163.0 94.0 NaN 177.0 \n","473 RUS 63 18 4.0 256.0 268.0 269.0 230.0 \n","385 HAM 44 18 5.0 271.0 272.0 274.0 302.0 \n","474 RUS 63 19 4.0 272.0 276.0 274.0 289.0 \n","386 HAM 44 19 5.0 275.0 270.0 278.0 304.0 \n","387 HAM 44 20 5.0 276.0 270.0 278.0 307.0 \n","475 RUS 63 20 4.0 273.0 255.0 273.0 298.0 \n","388 HAM 44 21 5.0 273.0 160.0 275.0 NaN \n","476 RUS 63 21 4.0 268.0 274.0 275.0 301.0 \n","389 HAM 44 22 5.0 NaN 268.0 275.0 303.0 \n","477 RUS 63 22 4.0 272.0 272.0 277.0 303.0 \n","390 HAM 44 23 5.0 275.0 274.0 273.0 301.0 \n","478 RUS 63 23 4.0 276.0 271.0 NaN 304.0 \n","391 HAM 44 24 5.0 278.0 275.0 275.0 302.0 \n","479 RUS 63 24 5.0 270.0 269.0 277.0 249.0 \n","480 RUS 63 25 5.0 274.0 277.0 277.0 298.0 \n","392 HAM 44 25 5.0 269.0 247.0 278.0 303.0 \n","393 HAM 44 26 5.0 276.0 279.0 275.0 324.0 \n","481 RUS 63 26 5.0 270.0 282.0 278.0 300.0 \n","394 HAM 44 27 5.0 148.0 133.0 15.0 284.0 \n","482 RUS 63 27 5.0 266.0 280.0 277.0 321.0 \n","483 RUS 63 28 5.0 268.0 278.0 280.0 303.0 \n","395 HAM 44 28 5.0 261.0 270.0 NaN 273.0 \n","484 RUS 63 29 5.0 267.0 269.0 275.0 324.0 \n","485 RUS 63 30 5.0 165.0 150.0 39.0 208.0 \n","486 RUS 63 31 5.0 255.0 249.0 NaN 281.0 \n","\n"," IsPersonalBest Compound ... FastF1Generated IsAccurate LapTimeSeconds \\\n","368 False HARD ... False False NaN \n","456 False HARD ... False False NaN \n","457 True HARD ... False True 77.024 \n","369 True HARD ... False True 77.632 \n","458 False HARD ... False True 132.103 \n","370 False HARD ... False False 138.480 \n","459 True HARD ... False True 75.868 \n","371 False HARD ... False False 138.969 \n","460 False HARD ... False False 114.638 \n","372 True HARD ... False True 76.650 \n","461 False HARD ... False False 148.324 \n","373 False HARD ... False True 134.917 \n","462 True HARD ... False True 75.692 \n","374 True HARD ... False True 76.203 \n","463 False HARD ... False True 140.851 \n","375 False HARD ... False True 142.788 \n","464 False HARD ... False True 111.772 \n","376 True HARD ... False True 76.079 \n","377 False HARD ... False False 98.026 \n","465 True HARD ... False True 75.563 \n","378 False MEDIUM ... False False NaN \n","466 False HARD ... False False 100.057 \n","467 False MEDIUM ... False False NaN \n","379 True MEDIUM ... False True 74.911 \n","468 True MEDIUM ... False True 74.753 \n","380 False MEDIUM ... False False 146.607 \n","469 False MEDIUM ... False True 146.632 \n","381 False MEDIUM ... False False NaN \n","470 False MEDIUM ... False True 135.035 \n","382 False MEDIUM ... False False NaN \n","471 True MEDIUM ... False True 74.614 \n","383 False MEDIUM ... False False NaN \n","384 False MEDIUM ... False True 80.300 \n","472 False MEDIUM ... False False NaN \n","473 False HARD ... False False NaN \n","385 False MEDIUM ... False True 79.933 \n","474 False HARD ... False True 80.780 \n","386 False MEDIUM ... False True 80.114 \n","387 False MEDIUM ... False True 80.399 \n","475 False HARD ... False True 83.024 \n","388 False MEDIUM ... False True 84.782 \n","476 False HARD ... False True 81.062 \n","389 False MEDIUM ... False True 80.692 \n","477 False HARD ... False True 80.558 \n","390 False MEDIUM ... False True 81.582 \n","478 False HARD ... False False 85.125 \n","391 False MEDIUM ... False True 81.299 \n","479 False HARD ... False False 106.574 \n","480 False HARD ... False True 81.085 \n","392 False MEDIUM ... False True 84.346 \n","393 False MEDIUM ... False True 80.920 \n","481 False HARD ... False True 80.941 \n","394 False MEDIUM ... False True 137.310 \n","482 False HARD ... False True 81.028 \n","483 False HARD ... False True 81.183 \n","395 False MEDIUM ... False False 122.684 \n","484 False HARD ... False True 81.520 \n","485 False HARD ... False True 129.533 \n","486 False HARD ... False False 133.368 \n","\n"," PitOutTimeSeconds PitInTimeSeconds Sector1TimeSeconds Sector2TimeSeconds \\\n","368 855.834 NaN NaN 35.817 \n","456 858.199 NaN NaN 37.699 \n","457 NaN NaN 22.713 30.820 \n","369 NaN NaN 22.815 31.375 \n","458 NaN NaN 38.542 57.766 \n","370 NaN 1174.540 34.776 60.313 \n","459 NaN NaN 22.485 30.537 \n","371 1202.155 NaN 60.718 46.940 \n","460 NaN 1352.485 32.708 46.244 \n","372 NaN NaN 22.563 30.890 \n","461 1387.823 NaN 71.103 45.840 \n","373 NaN NaN 38.007 63.469 \n","462 NaN NaN 22.381 30.512 \n","374 NaN NaN 22.476 30.863 \n","463 NaN NaN 42.611 61.345 \n","375 NaN NaN 37.938 71.921 \n","464 NaN NaN 32.088 45.577 \n","376 NaN NaN 22.381 30.719 \n","377 NaN 1918.275 31.475 38.165 \n","465 NaN NaN 22.370 30.351 \n","378 2539.519 NaN NaN 41.524 \n","466 NaN 2004.758 28.927 40.110 \n","467 2485.373 NaN NaN 40.206 \n","379 NaN NaN 22.049 30.005 \n","468 NaN NaN 22.300 29.889 \n","380 NaN 2856.777 38.139 63.431 \n","469 NaN NaN 44.358 57.191 \n","381 2886.274 NaN 74.776 58.757 \n","470 NaN NaN 43.917 57.054 \n","382 NaN 3103.838 22.202 30.614 \n","471 NaN NaN 22.212 29.903 \n","383 3568.864 NaN NaN 33.914 \n","384 NaN NaN 24.169 32.190 \n","472 NaN 3143.256 35.429 48.110 \n","473 3488.831 NaN NaN 33.344 \n","385 NaN NaN 23.627 32.173 \n","474 NaN NaN 24.289 32.265 \n","386 NaN NaN 23.769 32.242 \n","387 NaN NaN 23.791 32.414 \n","475 NaN NaN 23.963 32.480 \n","388 NaN NaN 23.722 34.074 \n","476 NaN NaN 24.061 32.573 \n","389 NaN NaN 23.638 32.750 \n","477 NaN NaN 23.960 32.354 \n","390 NaN NaN 23.764 32.576 \n","478 NaN 4003.719 23.783 32.786 \n","391 NaN NaN 24.061 32.758 \n","479 4030.111 NaN 49.039 33.223 \n","480 NaN NaN 23.902 32.787 \n","392 NaN NaN 24.494 33.214 \n","393 NaN NaN 23.751 32.744 \n","481 NaN NaN 23.989 32.525 \n","394 NaN NaN 33.224 51.297 \n","482 NaN NaN 23.749 32.770 \n","483 NaN NaN 23.870 32.863 \n","395 NaN 4746.487 58.090 35.919 \n","484 NaN NaN 23.454 33.259 \n","485 NaN NaN 33.107 45.718 \n","486 NaN 4778.937 56.732 46.638 \n","\n"," Sector3TimeSeconds LapStartTimeSeconds TimeInMinutes \n","368 24.869 855.834 16.018517 \n","456 33.034 858.199 15.925883 \n","457 23.491 955.553 17.209617 \n","369 23.442 961.111 17.312383 \n","458 35.795 1032.577 19.411333 \n","370 43.391 1038.743 19.620383 \n","459 22.846 1164.680 20.675800 \n","371 31.311 1177.223 21.936533 \n","460 35.686 1240.548 22.586433 \n","372 23.197 1316.192 23.214033 \n","461 31.381 1355.186 25.058500 \n","373 33.441 1392.842 25.462650 \n","462 22.799 1503.510 26.320033 \n","374 22.864 1527.759 26.732700 \n","463 36.895 1579.202 28.667550 \n","375 32.929 1603.962 29.112500 \n","464 34.107 1720.053 30.530417 \n","376 22.979 1746.750 30.380483 \n","377 28.386 1822.829 32.014250 \n","465 22.842 1831.825 31.789800 \n","378 26.322 1920.855 43.966183 \n","466 31.020 1907.388 33.457417 \n","467 27.963 2007.445 43.125483 \n","379 22.857 2637.971 45.214700 \n","468 22.564 2587.529 44.371367 \n","380 45.037 2712.882 47.658150 \n","469 45.083 2662.282 46.815233 \n","381 29.366 2859.489 50.377317 \n","470 34.064 2808.914 49.065817 \n","382 NaN 3022.639 59.481067 \n","471 22.499 2943.949 50.309383 \n","383 31.005 3568.864 61.247617 \n","384 23.941 3674.857 62.585950 \n","472 NaN 3018.563 58.147183 \n","473 27.129 3488.831 59.932850 \n","385 24.133 3755.157 63.918167 \n","474 24.226 3595.971 61.279183 \n","386 24.103 3835.090 65.253400 \n","387 24.194 3915.204 66.593383 \n","475 26.581 3676.751 62.662917 \n","388 26.986 3995.603 68.006417 \n","476 24.428 3759.775 64.013950 \n","389 24.304 4080.385 69.351283 \n","477 24.244 3840.837 65.356583 \n","390 25.242 4161.077 70.710983 \n","478 28.556 3921.395 66.775333 \n","391 24.480 4242.659 72.065967 \n","479 24.312 4006.520 68.551567 \n","480 24.396 4113.094 69.902983 \n","392 26.638 4323.958 73.471733 \n","393 24.425 4408.304 74.820400 \n","481 24.427 4194.179 71.252000 \n","394 52.789 4489.224 77.108900 \n","482 24.509 4275.120 72.602467 \n","483 24.450 4356.148 73.955517 \n","395 28.675 4626.534 79.153633 \n","484 24.807 4437.331 75.314183 \n","485 50.708 4518.851 77.473067 \n","486 29.998 4648.384 79.695867 \n","\n","[59 rows x 28 columns]"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["df['TimeInMinutes'] = df['Time'].dt.total_seconds() / 60\n","df.drop(columns=['Time'], inplace=True, axis=1)\n","df"]},{"cell_type":"code","execution_count":5,"metadata":{},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
DriverDriverNumberLapNumberStintSpeedI1SpeedI2SpeedFLSpeedSTIsPersonalBestCompound...FastF1GeneratedIsAccurateLapTimeSecondsPitOutTimeSecondsPitInTimeSecondsSector1TimeSecondsSector2TimeSecondsSector3TimeSecondsLapStartTimeSecondsTimeInMinutes
368HAM4411.0215.0220.0281.0207.0FalseHARD...FalseFalseNaN855.834NaNNaN35.81724.869855.83416.018517
456RUS6311.0208.079.0282.0241.0FalseHARD...FalseFalseNaN858.199NaNNaN37.69933.034858.19915.925883
457RUS6321.0275.0292.0285.0316.0TrueHARD...FalseTrue77.024NaNNaN22.71330.82023.491955.55317.209617
369HAM4421.0287.0287.0282.0316.0TrueHARD...FalseTrue77.632NaNNaN22.81531.37523.442961.11117.312383
458RUS6331.0128.0152.0280.0258.0FalseHARD...FalseTrue132.103NaNNaN38.54257.76635.7951032.57719.411333
370HAM4431.0124.0127.0NaN252.0FalseHARD...FalseFalse138.480NaN1174.54034.77660.31343.3911038.74319.620383
459RUS6341.0282.0291.0282.0318.0TrueHARD...FalseTrue75.868NaNNaN22.48530.53722.8461164.68020.675800
371HAM4442.0162.0209.0280.0149.0FalseHARD...FalseFalse138.9691202.155NaN60.71846.94031.3111177.22321.936533
460RUS6351.0178.0220.0NaN276.0FalseHARD...FalseFalse114.638NaN1352.48532.70846.24435.6861240.54822.586433
372HAM4452.0288.0301.0280.0318.0TrueHARD...FalseTrue76.650NaNNaN22.56330.89023.1971316.19223.214033
461RUS6362.0158.0193.0280.0144.0FalseHARD...FalseFalse148.3241387.823NaN71.10345.84031.3811355.18625.058500
373HAM4462.0125.0110.0282.0262.0FalseHARD...FalseTrue134.917NaNNaN38.00763.46933.4411392.84225.462650
462RUS6372.0288.0297.0284.0313.0TrueHARD...FalseTrue75.692NaNNaN22.38130.51222.7991503.51026.320033
374HAM4472.0288.0303.0281.0315.0TrueHARD...FalseTrue76.203NaNNaN22.47630.86322.8641527.75926.732700
463RUS6382.0132.0190.0190.0150.0FalseHARD...FalseTrue140.851NaNNaN42.61161.34536.8951579.20228.667550
375HAM4482.0102.0132.0280.0298.0FalseHARD...FalseTrue142.788NaNNaN37.93871.92132.9291603.96229.112500
464RUS6392.0179.0233.0281.0277.0FalseHARD...FalseTrue111.772NaNNaN32.08845.57734.1071720.05330.530417
376HAM4492.0288.0307.0281.0316.0TrueHARD...FalseTrue76.079NaNNaN22.38130.71922.9791746.75030.380483
377HAM44102.0174.0230.0NaN258.0FalseHARD...FalseFalse98.026NaN1918.27531.47538.16528.3861822.82932.014250
465RUS63102.0287.0299.0283.0315.0TrueHARD...FalseTrue75.563NaNNaN22.37030.35122.8421831.82531.789800
378HAM44113.0206.0151.0283.0202.0FalseMEDIUM...FalseFalseNaN2539.519NaNNaN41.52426.3221920.85543.966183
466RUS63112.0179.0237.0NaN240.0FalseHARD...FalseFalse100.057NaN2004.75828.92740.11031.0201907.38833.457417
467RUS63123.0224.0243.0281.0157.0FalseMEDIUM...FalseFalseNaN2485.373NaNNaN40.20627.9632007.44543.125483
379HAM44123.0289.0309.0284.0320.0TrueMEDIUM...FalseTrue74.911NaNNaN22.04930.00522.8572637.97145.214700
468RUS63133.0285.0306.0283.0311.0TrueMEDIUM...FalseTrue74.753NaNNaN22.30029.88922.5642587.52944.371367
380HAM44133.0119.0154.0NaN301.0FalseMEDIUM...FalseFalse146.607NaN2856.77738.13963.43145.0372712.88247.658150
469RUS63143.0138.0150.0151.0137.0FalseMEDIUM...FalseTrue146.632NaNNaN44.35857.19145.0832662.28246.815233
381HAM44144.0112.0205.0283.0126.0FalseMEDIUM...FalseFalseNaN2886.274NaN74.77658.75729.3662859.48950.377317
470RUS63153.0118.097.0281.0198.0FalseMEDIUM...FalseTrue135.035NaNNaN43.91757.05434.0642808.91449.065817
382HAM44154.0289.0226.0NaN316.0FalseMEDIUM...FalseFalseNaNNaN3103.83822.20230.614NaN3022.63959.481067
471RUS63163.0289.0308.0281.0313.0TrueMEDIUM...FalseTrue74.614NaNNaN22.21229.90322.4992943.94950.309383
383HAM44165.0268.0157.0272.0235.0FalseMEDIUM...FalseFalseNaN3568.864NaNNaN33.91431.0053568.86461.247617
384HAM44175.0269.0264.0273.0295.0FalseMEDIUM...FalseTrue80.300NaNNaN24.16932.19023.9413674.85762.585950
472RUS63173.0163.094.0NaN177.0FalseMEDIUM...FalseFalseNaNNaN3143.25635.42948.110NaN3018.56358.147183
473RUS63184.0256.0268.0269.0230.0FalseHARD...FalseFalseNaN3488.831NaNNaN33.34427.1293488.83159.932850
385HAM44185.0271.0272.0274.0302.0FalseMEDIUM...FalseTrue79.933NaNNaN23.62732.17324.1333755.15763.918167
474RUS63194.0272.0276.0274.0289.0FalseHARD...FalseTrue80.780NaNNaN24.28932.26524.2263595.97161.279183
386HAM44195.0275.0270.0278.0304.0FalseMEDIUM...FalseTrue80.114NaNNaN23.76932.24224.1033835.09065.253400
387HAM44205.0276.0270.0278.0307.0FalseMEDIUM...FalseTrue80.399NaNNaN23.79132.41424.1943915.20466.593383
475RUS63204.0273.0255.0273.0298.0FalseHARD...FalseTrue83.024NaNNaN23.96332.48026.5813676.75162.662917
388HAM44215.0273.0160.0275.0NaNFalseMEDIUM...FalseTrue84.782NaNNaN23.72234.07426.9863995.60368.006417
476RUS63214.0268.0274.0275.0301.0FalseHARD...FalseTrue81.062NaNNaN24.06132.57324.4283759.77564.013950
389HAM44225.0NaN268.0275.0303.0FalseMEDIUM...FalseTrue80.692NaNNaN23.63832.75024.3044080.38569.351283
477RUS63224.0272.0272.0277.0303.0FalseHARD...FalseTrue80.558NaNNaN23.96032.35424.2443840.83765.356583
390HAM44235.0275.0274.0273.0301.0FalseMEDIUM...FalseTrue81.582NaNNaN23.76432.57625.2424161.07770.710983
478RUS63234.0276.0271.0NaN304.0FalseHARD...FalseFalse85.125NaN4003.71923.78332.78628.5563921.39566.775333
391HAM44245.0278.0275.0275.0302.0FalseMEDIUM...FalseTrue81.299NaNNaN24.06132.75824.4804242.65972.065967
479RUS63245.0270.0269.0277.0249.0FalseHARD...FalseFalse106.5744030.111NaN49.03933.22324.3124006.52068.551567
480RUS63255.0274.0277.0277.0298.0FalseHARD...FalseTrue81.085NaNNaN23.90232.78724.3964113.09469.902983
392HAM44255.0269.0247.0278.0303.0FalseMEDIUM...FalseTrue84.346NaNNaN24.49433.21426.6384323.95873.471733
393HAM44265.0276.0279.0275.0324.0FalseMEDIUM...FalseTrue80.920NaNNaN23.75132.74424.4254408.30474.820400
481RUS63265.0270.0282.0278.0300.0FalseHARD...FalseTrue80.941NaNNaN23.98932.52524.4274194.17971.252000
394HAM44275.0148.0133.015.0284.0FalseMEDIUM...FalseTrue137.310NaNNaN33.22451.29752.7894489.22477.108900
482RUS63275.0266.0280.0277.0321.0FalseHARD...FalseTrue81.028NaNNaN23.74932.77024.5094275.12072.602467
483RUS63285.0268.0278.0280.0303.0FalseHARD...FalseTrue81.183NaNNaN23.87032.86324.4504356.14873.955517
395HAM44285.0261.0270.0NaN273.0FalseMEDIUM...FalseFalse122.684NaN4746.48758.09035.91928.6754626.53479.153633
484RUS63295.0267.0269.0275.0324.0FalseHARD...FalseTrue81.520NaNNaN23.45433.25924.8074437.33175.314183
485RUS63305.0165.0150.039.0208.0FalseHARD...FalseTrue129.533NaNNaN33.10745.71850.7084518.85177.473067
486RUS63315.0255.0249.0NaN281.0FalseHARD...FalseFalse133.368NaN4778.93756.73246.63829.9984648.38479.695867
\n","

59 rows × 28 columns

\n","
"],"text/plain":[" Driver DriverNumber LapNumber Stint SpeedI1 SpeedI2 SpeedFL SpeedST \\\n","368 HAM 44 1 1.0 215.0 220.0 281.0 207.0 \n","456 RUS 63 1 1.0 208.0 79.0 282.0 241.0 \n","457 RUS 63 2 1.0 275.0 292.0 285.0 316.0 \n","369 HAM 44 2 1.0 287.0 287.0 282.0 316.0 \n","458 RUS 63 3 1.0 128.0 152.0 280.0 258.0 \n","370 HAM 44 3 1.0 124.0 127.0 NaN 252.0 \n","459 RUS 63 4 1.0 282.0 291.0 282.0 318.0 \n","371 HAM 44 4 2.0 162.0 209.0 280.0 149.0 \n","460 RUS 63 5 1.0 178.0 220.0 NaN 276.0 \n","372 HAM 44 5 2.0 288.0 301.0 280.0 318.0 \n","461 RUS 63 6 2.0 158.0 193.0 280.0 144.0 \n","373 HAM 44 6 2.0 125.0 110.0 282.0 262.0 \n","462 RUS 63 7 2.0 288.0 297.0 284.0 313.0 \n","374 HAM 44 7 2.0 288.0 303.0 281.0 315.0 \n","463 RUS 63 8 2.0 132.0 190.0 190.0 150.0 \n","375 HAM 44 8 2.0 102.0 132.0 280.0 298.0 \n","464 RUS 63 9 2.0 179.0 233.0 281.0 277.0 \n","376 HAM 44 9 2.0 288.0 307.0 281.0 316.0 \n","377 HAM 44 10 2.0 174.0 230.0 NaN 258.0 \n","465 RUS 63 10 2.0 287.0 299.0 283.0 315.0 \n","378 HAM 44 11 3.0 206.0 151.0 283.0 202.0 \n","466 RUS 63 11 2.0 179.0 237.0 NaN 240.0 \n","467 RUS 63 12 3.0 224.0 243.0 281.0 157.0 \n","379 HAM 44 12 3.0 289.0 309.0 284.0 320.0 \n","468 RUS 63 13 3.0 285.0 306.0 283.0 311.0 \n","380 HAM 44 13 3.0 119.0 154.0 NaN 301.0 \n","469 RUS 63 14 3.0 138.0 150.0 151.0 137.0 \n","381 HAM 44 14 4.0 112.0 205.0 283.0 126.0 \n","470 RUS 63 15 3.0 118.0 97.0 281.0 198.0 \n","382 HAM 44 15 4.0 289.0 226.0 NaN 316.0 \n","471 RUS 63 16 3.0 289.0 308.0 281.0 313.0 \n","383 HAM 44 16 5.0 268.0 157.0 272.0 235.0 \n","384 HAM 44 17 5.0 269.0 264.0 273.0 295.0 \n","472 RUS 63 17 3.0 163.0 94.0 NaN 177.0 \n","473 RUS 63 18 4.0 256.0 268.0 269.0 230.0 \n","385 HAM 44 18 5.0 271.0 272.0 274.0 302.0 \n","474 RUS 63 19 4.0 272.0 276.0 274.0 289.0 \n","386 HAM 44 19 5.0 275.0 270.0 278.0 304.0 \n","387 HAM 44 20 5.0 276.0 270.0 278.0 307.0 \n","475 RUS 63 20 4.0 273.0 255.0 273.0 298.0 \n","388 HAM 44 21 5.0 273.0 160.0 275.0 NaN \n","476 RUS 63 21 4.0 268.0 274.0 275.0 301.0 \n","389 HAM 44 22 5.0 NaN 268.0 275.0 303.0 \n","477 RUS 63 22 4.0 272.0 272.0 277.0 303.0 \n","390 HAM 44 23 5.0 275.0 274.0 273.0 301.0 \n","478 RUS 63 23 4.0 276.0 271.0 NaN 304.0 \n","391 HAM 44 24 5.0 278.0 275.0 275.0 302.0 \n","479 RUS 63 24 5.0 270.0 269.0 277.0 249.0 \n","480 RUS 63 25 5.0 274.0 277.0 277.0 298.0 \n","392 HAM 44 25 5.0 269.0 247.0 278.0 303.0 \n","393 HAM 44 26 5.0 276.0 279.0 275.0 324.0 \n","481 RUS 63 26 5.0 270.0 282.0 278.0 300.0 \n","394 HAM 44 27 5.0 148.0 133.0 15.0 284.0 \n","482 RUS 63 27 5.0 266.0 280.0 277.0 321.0 \n","483 RUS 63 28 5.0 268.0 278.0 280.0 303.0 \n","395 HAM 44 28 5.0 261.0 270.0 NaN 273.0 \n","484 RUS 63 29 5.0 267.0 269.0 275.0 324.0 \n","485 RUS 63 30 5.0 165.0 150.0 39.0 208.0 \n","486 RUS 63 31 5.0 255.0 249.0 NaN 281.0 \n","\n"," IsPersonalBest Compound ... FastF1Generated IsAccurate LapTimeSeconds \\\n","368 False HARD ... False False NaN \n","456 False HARD ... False False NaN \n","457 True HARD ... False True 77.024 \n","369 True HARD ... False True 77.632 \n","458 False HARD ... False True 132.103 \n","370 False HARD ... False False 138.480 \n","459 True HARD ... False True 75.868 \n","371 False HARD ... False False 138.969 \n","460 False HARD ... False False 114.638 \n","372 True HARD ... False True 76.650 \n","461 False HARD ... False False 148.324 \n","373 False HARD ... False True 134.917 \n","462 True HARD ... False True 75.692 \n","374 True HARD ... False True 76.203 \n","463 False HARD ... False True 140.851 \n","375 False HARD ... False True 142.788 \n","464 False HARD ... False True 111.772 \n","376 True HARD ... False True 76.079 \n","377 False HARD ... False False 98.026 \n","465 True HARD ... False True 75.563 \n","378 False MEDIUM ... False False NaN \n","466 False HARD ... False False 100.057 \n","467 False MEDIUM ... False False NaN \n","379 True MEDIUM ... False True 74.911 \n","468 True MEDIUM ... False True 74.753 \n","380 False MEDIUM ... False False 146.607 \n","469 False MEDIUM ... False True 146.632 \n","381 False MEDIUM ... False False NaN \n","470 False MEDIUM ... False True 135.035 \n","382 False MEDIUM ... False False NaN \n","471 True MEDIUM ... False True 74.614 \n","383 False MEDIUM ... False False NaN \n","384 False MEDIUM ... False True 80.300 \n","472 False MEDIUM ... False False NaN \n","473 False HARD ... False False NaN \n","385 False MEDIUM ... False True 79.933 \n","474 False HARD ... False True 80.780 \n","386 False MEDIUM ... False True 80.114 \n","387 False MEDIUM ... False True 80.399 \n","475 False HARD ... False True 83.024 \n","388 False MEDIUM ... False True 84.782 \n","476 False HARD ... False True 81.062 \n","389 False MEDIUM ... False True 80.692 \n","477 False HARD ... False True 80.558 \n","390 False MEDIUM ... False True 81.582 \n","478 False HARD ... False False 85.125 \n","391 False MEDIUM ... False True 81.299 \n","479 False HARD ... False False 106.574 \n","480 False HARD ... False True 81.085 \n","392 False MEDIUM ... False True 84.346 \n","393 False MEDIUM ... False True 80.920 \n","481 False HARD ... False True 80.941 \n","394 False MEDIUM ... False True 137.310 \n","482 False HARD ... False True 81.028 \n","483 False HARD ... False True 81.183 \n","395 False MEDIUM ... False False 122.684 \n","484 False HARD ... False True 81.520 \n","485 False HARD ... False True 129.533 \n","486 False HARD ... False False 133.368 \n","\n"," PitOutTimeSeconds PitInTimeSeconds Sector1TimeSeconds Sector2TimeSeconds \\\n","368 855.834 NaN NaN 35.817 \n","456 858.199 NaN NaN 37.699 \n","457 NaN NaN 22.713 30.820 \n","369 NaN NaN 22.815 31.375 \n","458 NaN NaN 38.542 57.766 \n","370 NaN 1174.540 34.776 60.313 \n","459 NaN NaN 22.485 30.537 \n","371 1202.155 NaN 60.718 46.940 \n","460 NaN 1352.485 32.708 46.244 \n","372 NaN NaN 22.563 30.890 \n","461 1387.823 NaN 71.103 45.840 \n","373 NaN NaN 38.007 63.469 \n","462 NaN NaN 22.381 30.512 \n","374 NaN NaN 22.476 30.863 \n","463 NaN NaN 42.611 61.345 \n","375 NaN NaN 37.938 71.921 \n","464 NaN NaN 32.088 45.577 \n","376 NaN NaN 22.381 30.719 \n","377 NaN 1918.275 31.475 38.165 \n","465 NaN NaN 22.370 30.351 \n","378 2539.519 NaN NaN 41.524 \n","466 NaN 2004.758 28.927 40.110 \n","467 2485.373 NaN NaN 40.206 \n","379 NaN NaN 22.049 30.005 \n","468 NaN NaN 22.300 29.889 \n","380 NaN 2856.777 38.139 63.431 \n","469 NaN NaN 44.358 57.191 \n","381 2886.274 NaN 74.776 58.757 \n","470 NaN NaN 43.917 57.054 \n","382 NaN 3103.838 22.202 30.614 \n","471 NaN NaN 22.212 29.903 \n","383 3568.864 NaN NaN 33.914 \n","384 NaN NaN 24.169 32.190 \n","472 NaN 3143.256 35.429 48.110 \n","473 3488.831 NaN NaN 33.344 \n","385 NaN NaN 23.627 32.173 \n","474 NaN NaN 24.289 32.265 \n","386 NaN NaN 23.769 32.242 \n","387 NaN NaN 23.791 32.414 \n","475 NaN NaN 23.963 32.480 \n","388 NaN NaN 23.722 34.074 \n","476 NaN NaN 24.061 32.573 \n","389 NaN NaN 23.638 32.750 \n","477 NaN NaN 23.960 32.354 \n","390 NaN NaN 23.764 32.576 \n","478 NaN 4003.719 23.783 32.786 \n","391 NaN NaN 24.061 32.758 \n","479 4030.111 NaN 49.039 33.223 \n","480 NaN NaN 23.902 32.787 \n","392 NaN NaN 24.494 33.214 \n","393 NaN NaN 23.751 32.744 \n","481 NaN NaN 23.989 32.525 \n","394 NaN NaN 33.224 51.297 \n","482 NaN NaN 23.749 32.770 \n","483 NaN NaN 23.870 32.863 \n","395 NaN 4746.487 58.090 35.919 \n","484 NaN NaN 23.454 33.259 \n","485 NaN NaN 33.107 45.718 \n","486 NaN 4778.937 56.732 46.638 \n","\n"," Sector3TimeSeconds LapStartTimeSeconds TimeInMinutes \n","368 24.869 855.834 16.018517 \n","456 33.034 858.199 15.925883 \n","457 23.491 955.553 17.209617 \n","369 23.442 961.111 17.312383 \n","458 35.795 1032.577 19.411333 \n","370 43.391 1038.743 19.620383 \n","459 22.846 1164.680 20.675800 \n","371 31.311 1177.223 21.936533 \n","460 35.686 1240.548 22.586433 \n","372 23.197 1316.192 23.214033 \n","461 31.381 1355.186 25.058500 \n","373 33.441 1392.842 25.462650 \n","462 22.799 1503.510 26.320033 \n","374 22.864 1527.759 26.732700 \n","463 36.895 1579.202 28.667550 \n","375 32.929 1603.962 29.112500 \n","464 34.107 1720.053 30.530417 \n","376 22.979 1746.750 30.380483 \n","377 28.386 1822.829 32.014250 \n","465 22.842 1831.825 31.789800 \n","378 26.322 1920.855 43.966183 \n","466 31.020 1907.388 33.457417 \n","467 27.963 2007.445 43.125483 \n","379 22.857 2637.971 45.214700 \n","468 22.564 2587.529 44.371367 \n","380 45.037 2712.882 47.658150 \n","469 45.083 2662.282 46.815233 \n","381 29.366 2859.489 50.377317 \n","470 34.064 2808.914 49.065817 \n","382 NaN 3022.639 59.481067 \n","471 22.499 2943.949 50.309383 \n","383 31.005 3568.864 61.247617 \n","384 23.941 3674.857 62.585950 \n","472 NaN 3018.563 58.147183 \n","473 27.129 3488.831 59.932850 \n","385 24.133 3755.157 63.918167 \n","474 24.226 3595.971 61.279183 \n","386 24.103 3835.090 65.253400 \n","387 24.194 3915.204 66.593383 \n","475 26.581 3676.751 62.662917 \n","388 26.986 3995.603 68.006417 \n","476 24.428 3759.775 64.013950 \n","389 24.304 4080.385 69.351283 \n","477 24.244 3840.837 65.356583 \n","390 25.242 4161.077 70.710983 \n","478 28.556 3921.395 66.775333 \n","391 24.480 4242.659 72.065967 \n","479 24.312 4006.520 68.551567 \n","480 24.396 4113.094 69.902983 \n","392 26.638 4323.958 73.471733 \n","393 24.425 4408.304 74.820400 \n","481 24.427 4194.179 71.252000 \n","394 52.789 4489.224 77.108900 \n","482 24.509 4275.120 72.602467 \n","483 24.450 4356.148 73.955517 \n","395 28.675 4626.534 79.153633 \n","484 24.807 4437.331 75.314183 \n","485 50.708 4518.851 77.473067 \n","486 29.998 4648.384 79.695867 \n","\n","[59 rows x 28 columns]"]},"execution_count":5,"metadata":{},"output_type":"execute_result"}],"source":["df"]},{"cell_type":"markdown","metadata":{},"source":["## Document Loading\n","\n","https://python.langchain.com/v0.1/docs/use_cases/sql/\n"]},{"cell_type":"code","execution_count":11,"metadata":{},"outputs":[{"data":{"text/plain":["59"]},"execution_count":11,"metadata":{},"output_type":"execute_result"}],"source":["from sqlalchemy import create_engine\n","engine = create_engine('sqlite:///laps.db')\n","\n","df.to_sql(name=\"laps\", con=engine)"]},{"cell_type":"code","execution_count":12,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["[(368, 'HAM', '44', 1, 1.0, 215.0, 220.0, 281.0, 207.0, 0, 'HARD', 1.0, 1, 'Mercedes', '2024-06-21 11:30:16.280000', '1', None, None, '', 0, 0, None, 855.834, None, None, 35.817, 24.869, 855.834, 16.018516666666667), (456, 'RUS', '63', 1, 1.0, 208.0, 79.0, 282.0, 241.0, 0, 'HARD', 1.0, 1, 'Mercedes', '2024-06-21 11:30:18.645000', '1', None, None, '', 0, 0, None, 858.199, None, None, 37.699, 33.034, 858.199, 15.925883333333333), (457, 'RUS', '63', 2, 1.0, 275.0, 292.0, 285.0, 316.0, 1, 'HARD', 2.0, 1, 'Mercedes', '2024-06-21 11:31:55.999000', '1', None, None, '', 0, 1, 77.024, None, None, 22.713, 30.82, 23.491, 955.553, 17.209616666666665), (369, 'HAM', '44', 2, 1.0, 287.0, 287.0, 282.0, 316.0, 1, 'HARD', 2.0, 1, 'Mercedes', '2024-06-21 11:32:01.557000', '1', None, None, '', 0, 1, 77.632, None, None, 22.815, 31.375, 23.442, 961.111, 17.312383333333333), (458, 'RUS', '63', 3, 1.0, 128.0, 152.0, 280.0, 258.0, 0, 'HARD', 3.0, 1, 'Mercedes', '2024-06-21 11:33:13.023000', '1', None, None, '', 0, 1, 132.103, None, None, 38.542, 57.766, 35.795, 1032.577, 19.411333333333335), (370, 'HAM', '44', 3, 1.0, 124.0, 127.0, None, 252.0, 0, 'HARD', 3.0, 1, 'Mercedes', '2024-06-21 11:33:19.189000', '1', None, None, '', 0, 0, 138.48, None, 1174.54, 34.776, 60.313, 43.391, 1038.743, 19.620383333333333), (459, 'RUS', '63', 4, 1.0, 282.0, 291.0, 282.0, 318.0, 1, 'HARD', 4.0, 1, 'Mercedes', '2024-06-21 11:35:25.126000', '1', None, None, '', 0, 1, 75.868, None, None, 22.485, 30.537, 22.846, 1164.68, 20.6758), (371, 'HAM', '44', 4, 2.0, 162.0, 209.0, 280.0, 149.0, 0, 'HARD', 4.0, 0, 'Mercedes', '2024-06-21 11:35:37.669000', '1', None, None, '', 0, 0, 138.969, 1202.155, None, 60.718, 46.94, 31.311, 1177.223, 21.936533333333333), (460, 'RUS', '63', 5, 1.0, 178.0, 220.0, None, 276.0, 0, 'HARD', 5.0, 1, 'Mercedes', '2024-06-21 11:36:40.994000', '1', None, None, '', 0, 0, 114.638, None, 1352.485, 32.708, 46.244, 35.686, 1240.548, 22.586433333333332), (372, 'HAM', '44', 5, 2.0, 288.0, 301.0, 280.0, 318.0, 1, 'HARD', 5.0, 0, 'Mercedes', '2024-06-21 11:37:56.638000', '1', None, None, '', 0, 1, 76.65, None, None, 22.563, 30.89, 23.197, 1316.192, 23.214033333333337), (461, 'RUS', '63', 6, 2.0, 158.0, 193.0, 280.0, 144.0, 0, 'HARD', 6.0, 0, 'Mercedes', '2024-06-21 11:38:35.632000', '1', None, None, '', 0, 0, 148.324, 1387.823, None, 71.103, 45.84, 31.381, 1355.186, 25.0585), (373, 'HAM', '44', 6, 2.0, 125.0, 110.0, 282.0, 262.0, 0, 'HARD', 6.0, 0, 'Mercedes', '2024-06-21 11:39:13.288000', '1', None, None, '', 0, 1, 134.917, None, None, 38.007, 63.469, 33.441, 1392.842, 25.46265), (462, 'RUS', '63', 7, 2.0, 288.0, 297.0, 284.0, 313.0, 1, 'HARD', 7.0, 0, 'Mercedes', '2024-06-21 11:41:03.956000', '1', None, None, '', 0, 1, 75.692, None, None, 22.381, 30.512, 22.799, 1503.51, 26.320033333333335), (374, 'HAM', '44', 7, 2.0, 288.0, 303.0, 281.0, 315.0, 1, 'HARD', 7.0, 0, 'Mercedes', '2024-06-21 11:41:28.205000', '1', None, None, '', 0, 1, 76.203, None, None, 22.476, 30.863, 22.864, 1527.759, 26.7327), (463, 'RUS', '63', 8, 2.0, 132.0, 190.0, 190.0, 150.0, 0, 'HARD', 8.0, 0, 'Mercedes', '2024-06-21 11:42:19.648000', '1', None, None, '', 0, 1, 140.851, None, None, 42.611, 61.345, 36.895, 1579.202, 28.667550000000002), (375, 'HAM', '44', 8, 2.0, 102.0, 132.0, 280.0, 298.0, 0, 'HARD', 8.0, 0, 'Mercedes', '2024-06-21 11:42:44.408000', '1', None, None, '', 0, 1, 142.788, None, None, 37.938, 71.921, 32.929, 1603.962, 29.1125), (464, 'RUS', '63', 9, 2.0, 179.0, 233.0, 281.0, 277.0, 0, 'HARD', 9.0, 0, 'Mercedes', '2024-06-21 11:44:40.499000', '1', None, None, '', 0, 1, 111.772, None, None, 32.088, 45.577, 34.107, 1720.053, 30.530416666666667), (376, 'HAM', '44', 9, 2.0, 288.0, 307.0, 281.0, 316.0, 1, 'HARD', 9.0, 0, 'Mercedes', '2024-06-21 11:45:07.196000', '1', None, None, '', 0, 1, 76.079, None, None, 22.381, 30.719, 22.979, 1746.75, 30.380483333333334), (377, 'HAM', '44', 10, 2.0, 174.0, 230.0, None, 258.0, 0, 'HARD', 10.0, 0, 'Mercedes', '2024-06-21 11:46:23.275000', '1', None, None, '', 0, 0, 98.026, None, 1918.275, 31.475, 38.165, 28.386, 1822.829, 32.01425), (465, 'RUS', '63', 10, 2.0, 287.0, 299.0, 283.0, 315.0, 1, 'HARD', 10.0, 0, 'Mercedes', '2024-06-21 11:46:32.271000', '1', None, None, '', 0, 1, 75.563, None, None, 22.37, 30.351, 22.842, 1831.825, 31.7898), (378, 'HAM', '44', 11, 3.0, 206.0, 151.0, 283.0, 202.0, 0, 'MEDIUM', 1.0, 1, 'Mercedes', '2024-06-21 11:48:01.301000', '1', None, None, '', 0, 0, None, 2539.519, None, None, 41.524, 26.322, 1920.855, 43.96618333333333), (466, 'RUS', '63', 11, 2.0, 179.0, 237.0, None, 240.0, 0, 'HARD', 11.0, 0, 'Mercedes', '2024-06-21 11:47:47.834000', '1', None, None, '', 0, 0, 100.057, None, 2004.758, 28.927, 40.11, 31.02, 1907.388, 33.45741666666667), (467, 'RUS', '63', 12, 3.0, 224.0, 243.0, 281.0, 157.0, 0, 'MEDIUM', 1.0, 1, 'Mercedes', '2024-06-21 11:49:27.891000', '1', None, None, '', 0, 0, None, 2485.373, None, None, 40.206, 27.963, 2007.445, 43.125483333333335), (379, 'HAM', '44', 12, 3.0, 289.0, 309.0, 284.0, 320.0, 1, 'MEDIUM', 2.0, 1, 'Mercedes', '2024-06-21 11:59:58.417000', '1', None, None, '', 0, 1, 74.911, None, None, 22.049, 30.005, 22.857, 2637.971, 45.2147), (468, 'RUS', '63', 13, 3.0, 285.0, 306.0, 283.0, 311.0, 1, 'MEDIUM', 2.0, 1, 'Mercedes', '2024-06-21 11:59:07.975000', '1', None, None, '', 0, 1, 74.753, None, None, 22.3, 29.889, 22.564, 2587.529, 44.37136666666667), (380, 'HAM', '44', 13, 3.0, 119.0, 154.0, None, 301.0, 0, 'MEDIUM', 3.0, 1, 'Mercedes', '2024-06-21 12:01:13.328000', '1', None, None, '', 0, 0, 146.607, None, 2856.777, 38.139, 63.431, 45.037, 2712.882, 47.65815), (469, 'RUS', '63', 14, 3.0, 138.0, 150.0, 151.0, 137.0, 0, 'MEDIUM', 3.0, 1, 'Mercedes', '2024-06-21 12:00:22.728000', '1', None, None, '', 0, 1, 146.632, None, None, 44.358, 57.191, 45.083, 2662.282, 46.81523333333334), (381, 'HAM', '44', 14, 4.0, 112.0, 205.0, 283.0, 126.0, 0, 'MEDIUM', 4.0, 0, 'Mercedes', '2024-06-21 12:03:39.935000', '1', None, None, '', 0, 0, None, 2886.274, None, 74.776, 58.757, 29.366, 2859.489, 50.377316666666665), (470, 'RUS', '63', 15, 3.0, 118.0, 97.0, 281.0, 198.0, 0, 'MEDIUM', 4.0, 1, 'Mercedes', '2024-06-21 12:02:49.360000', '1', None, None, '', 0, 1, 135.035, None, None, 43.917, 57.054, 34.064, 2808.914, 49.06581666666667), (382, 'HAM', '44', 15, 4.0, 289.0, 226.0, None, 316.0, 0, 'MEDIUM', 5.0, 0, 'Mercedes', '2024-06-21 12:06:23.085000', '15', None, None, '', 0, 0, None, None, 3103.838, 22.202, 30.614, None, 3022.639, 59.48106666666667), (471, 'RUS', '63', 16, 3.0, 289.0, 308.0, 281.0, 313.0, 1, 'MEDIUM', 5.0, 1, 'Mercedes', '2024-06-21 12:05:04.395000', '1', None, None, '', 0, 1, 74.614, None, None, 22.212, 29.903, 22.499, 2943.949, 50.30938333333334), (383, 'HAM', '44', 16, 5.0, 268.0, 157.0, 272.0, 235.0, 0, 'MEDIUM', 6.0, 0, 'Mercedes', '2024-06-21 12:15:29.310000', '1', None, None, '', 0, 0, None, 3568.864, None, None, 33.914, 31.005, 3568.864, 61.247616666666666), (384, 'HAM', '44', 17, 5.0, 269.0, 264.0, 273.0, 295.0, 0, 'MEDIUM', 7.0, 0, 'Mercedes', '2024-06-21 12:17:15.303000', '1', None, None, '', 0, 1, 80.3, None, None, 24.169, 32.19, 23.941, 3674.857, 62.585950000000004), (472, 'RUS', '63', 17, 3.0, 163.0, 94.0, None, 177.0, 0, 'MEDIUM', 6.0, 1, 'Mercedes', '2024-06-21 12:06:19.009000', '15', None, None, '', 0, 0, None, None, 3143.256, 35.429, 48.11, None, 3018.563, 58.14718333333334), (473, 'RUS', '63', 18, 4.0, 256.0, 268.0, 269.0, 230.0, 0, 'HARD', 12.0, 0, 'Mercedes', '2024-06-21 12:14:09.277000', '1', None, None, '', 0, 0, None, 3488.831, None, None, 33.344, 27.129, 3488.831, 59.93285), (385, 'HAM', '44', 18, 5.0, 271.0, 272.0, 274.0, 302.0, 0, 'MEDIUM', 8.0, 0, 'Mercedes', '2024-06-21 12:18:35.603000', '1', None, None, '', 0, 1, 79.933, None, None, 23.627, 32.173, 24.133, 3755.157, 63.91816666666667), (474, 'RUS', '63', 19, 4.0, 272.0, 276.0, 274.0, 289.0, 0, 'HARD', 13.0, 0, 'Mercedes', '2024-06-21 12:15:56.417000', '1', None, None, '', 0, 1, 80.78, None, None, 24.289, 32.265, 24.226, 3595.971, 61.279183333333336), (386, 'HAM', '44', 19, 5.0, 275.0, 270.0, 278.0, 304.0, 0, 'MEDIUM', 9.0, 0, 'Mercedes', '2024-06-21 12:19:55.536000', '1', None, None, '', 0, 1, 80.114, None, None, 23.769, 32.242, 24.103, 3835.09, 65.2534), (387, 'HAM', '44', 20, 5.0, 276.0, 270.0, 278.0, 307.0, 0, 'MEDIUM', 10.0, 0, 'Mercedes', '2024-06-21 12:21:15.650000', '1', None, None, '', 0, 1, 80.399, None, None, 23.791, 32.414, 24.194, 3915.204, 66.59338333333334), (475, 'RUS', '63', 20, 4.0, 273.0, 255.0, 273.0, 298.0, 0, 'HARD', 14.0, 0, 'Mercedes', '2024-06-21 12:17:17.197000', '1', None, None, '', 0, 1, 83.024, None, None, 23.963, 32.48, 26.581, 3676.751, 62.66291666666667), (388, 'HAM', '44', 21, 5.0, 273.0, 160.0, 275.0, None, 0, 'MEDIUM', 11.0, 0, 'Mercedes', '2024-06-21 12:22:36.049000', '1', None, None, '', 0, 1, 84.782, None, None, 23.722, 34.074, 26.986, 3995.603, 68.00641666666667), (476, 'RUS', '63', 21, 4.0, 268.0, 274.0, 275.0, 301.0, 0, 'HARD', 15.0, 0, 'Mercedes', '2024-06-21 12:18:40.221000', '1', None, None, '', 0, 1, 81.062, None, None, 24.061, 32.573, 24.428, 3759.775, 64.01395), (389, 'HAM', '44', 22, 5.0, None, 268.0, 275.0, 303.0, 0, 'MEDIUM', 12.0, 0, 'Mercedes', '2024-06-21 12:24:00.831000', '1', None, None, '', 0, 1, 80.692, None, None, 23.638, 32.75, 24.304, 4080.385, 69.35128333333334), (477, 'RUS', '63', 22, 4.0, 272.0, 272.0, 277.0, 303.0, 0, 'HARD', 16.0, 0, 'Mercedes', '2024-06-21 12:20:01.283000', '1', None, None, '', 0, 1, 80.558, None, None, 23.96, 32.354, 24.244, 3840.837, 65.35658333333333), (390, 'HAM', '44', 23, 5.0, 275.0, 274.0, 273.0, 301.0, 0, 'MEDIUM', 13.0, 0, 'Mercedes', '2024-06-21 12:25:21.523000', '1', None, None, '', 0, 1, 81.582, None, None, 23.764, 32.576, 25.242, 4161.077, 70.71098333333333), (478, 'RUS', '63', 23, 4.0, 276.0, 271.0, None, 304.0, 0, 'HARD', 17.0, 0, 'Mercedes', '2024-06-21 12:21:21.841000', '1', None, None, '', 0, 0, 85.125, None, 4003.719, 23.783, 32.786, 28.556, 3921.395, 66.77533333333334), (391, 'HAM', '44', 24, 5.0, 278.0, 275.0, 275.0, 302.0, 0, 'MEDIUM', 14.0, 0, 'Mercedes', '2024-06-21 12:26:43.105000', '1', None, None, '', 0, 1, 81.299, None, None, 24.061, 32.758, 24.48, 4242.659, 72.06596666666665), (479, 'RUS', '63', 24, 5.0, 270.0, 269.0, 277.0, 249.0, 0, 'HARD', 18.0, 0, 'Mercedes', '2024-06-21 12:22:46.966000', '1', None, None, '', 0, 0, 106.574, 4030.111, None, 49.039, 33.223, 24.312, 4006.52, 68.55156666666667), (480, 'RUS', '63', 25, 5.0, 274.0, 277.0, 277.0, 298.0, 0, 'HARD', 19.0, 0, 'Mercedes', '2024-06-21 12:24:33.540000', '1', None, None, '', 0, 1, 81.085, None, None, 23.902, 32.787, 24.396, 4113.094, 69.90298333333334), (392, 'HAM', '44', 25, 5.0, 269.0, 247.0, 278.0, 303.0, 0, 'MEDIUM', 15.0, 0, 'Mercedes', '2024-06-21 12:28:04.404000', '1', None, None, '', 0, 1, 84.346, None, None, 24.494, 33.214, 26.638, 4323.958, 73.47173333333333), (393, 'HAM', '44', 26, 5.0, 276.0, 279.0, 275.0, 324.0, 0, 'MEDIUM', 16.0, 0, 'Mercedes', '2024-06-21 12:29:28.750000', '1', None, None, '', 0, 1, 80.92, None, None, 23.751, 32.744, 24.425, 4408.304, 74.8204), (481, 'RUS', '63', 26, 5.0, 270.0, 282.0, 278.0, 300.0, 0, 'HARD', 20.0, 0, 'Mercedes', '2024-06-21 12:25:54.625000', '1', None, None, '', 0, 1, 80.941, None, None, 23.989, 32.525, 24.427, 4194.179, 71.252), (394, 'HAM', '44', 27, 5.0, 148.0, 133.0, 15.0, 284.0, 0, 'MEDIUM', 17.0, 0, 'Mercedes', '2024-06-21 12:30:49.670000', '1', None, None, '', 0, 1, 137.31, None, None, 33.224, 51.297, 52.789, 4489.224, 77.10889999999999), (482, 'RUS', '63', 27, 5.0, 266.0, 280.0, 277.0, 321.0, 0, 'HARD', 21.0, 0, 'Mercedes', '2024-06-21 12:27:15.566000', '1', None, None, '', 0, 1, 81.028, None, None, 23.749, 32.77, 24.509, 4275.12, 72.60246666666667), (483, 'RUS', '63', 28, 5.0, 268.0, 278.0, 280.0, 303.0, 0, 'HARD', 22.0, 0, 'Mercedes', '2024-06-21 12:28:36.594000', '1', None, None, '', 0, 1, 81.183, None, None, 23.87, 32.863, 24.45, 4356.148, 73.95551666666667), (395, 'HAM', '44', 28, 5.0, 261.0, 270.0, None, 273.0, 0, 'MEDIUM', 18.0, 0, 'Mercedes', '2024-06-21 12:33:06.980000', '1', None, None, '', 0, 0, 122.684, None, 4746.487, 58.09, 35.919, 28.675, 4626.534, 79.15363333333333), (484, 'RUS', '63', 29, 5.0, 267.0, 269.0, 275.0, 324.0, 0, 'HARD', 23.0, 0, 'Mercedes', '2024-06-21 12:29:57.777000', '1', None, None, '', 0, 1, 81.52, None, None, 23.454, 33.259, 24.807, 4437.331, 75.31418333333333), (485, 'RUS', '63', 30, 5.0, 165.0, 150.0, 39.0, 208.0, 0, 'HARD', 24.0, 0, 'Mercedes', '2024-06-21 12:31:19.297000', '1', None, None, '', 0, 1, 129.533, None, None, 33.107, 45.718, 50.708, 4518.851, 77.47306666666667), (486, 'RUS', '63', 31, 5.0, 255.0, 249.0, None, 281.0, 0, 'HARD', 25.0, 0, 'Mercedes', '2024-06-21 12:33:28.830000', '1', None, None, '', 0, 0, 133.368, None, 4778.937, 56.732, 46.638, 29.998, 4648.384, 79.69586666666667)]\n"]}],"source":["from sqlalchemy import text\n","with engine.connect() as conn:\n"," res = conn.execute(text(\"SELECT * FROM laps\")).fetchall()\n","\n"," print(res)"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":[]}],"metadata":{"kernelspec":{"display_name":"formula-1","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.0"}},"nbformat":4,"nbformat_minor":2} +{"cells":[{"cell_type":"markdown","metadata":{},"source":["# Save fastf1 data a to SQL database\n","\n","Useful for generating quick reports during the race.\n"]},{"cell_type":"code","execution_count":1,"metadata":{},"outputs":[{"name":"stderr","output_type":"stream","text":["req WARNING \tDEFAULT CACHE ENABLED! (1.04 GB) /Users/diegomaradona/Library/Caches/fastf1\n","core INFO \tLoading data for Spanish Grand Prix - Practice 1 [v3.3.3]\n","req INFO \tUsing cached data for session_info\n","req INFO \tUsing cached data for driver_info\n","req INFO \tUsing cached data for session_status_data\n","req INFO \tUsing cached data for track_status_data\n","req INFO \tUsing cached data for _extended_timing_data\n","req INFO \tUsing cached data for timing_app_data\n","core INFO \tProcessing timing data...\n","core WARNING \tNo lap data for driver 27\n","core WARNING \tFailed to perform lap accuracy check - all laps marked as inaccurate (driver 27)\n","req INFO \tUsing cached data for car_data\n","req INFO \tUsing cached data for position_data\n","core INFO \tFinished loading data for 21 drivers: ['1', '10', '11', '14', '16', '18', '2', '20', '22', '23', '24', '27', '3', '31', '4', '44', '50', '55', '63', '77', '81']\n"]}],"source":["import fastf1\n","\n","GRAND_PRIX = 'Spain'\n","YEAR = 2024\n","SESSION = 'FP1'\n","\n","session = fastf1.get_session(YEAR, GRAND_PRIX, SESSION)\n","session.load(weather=False, messages=False)"]},{"cell_type":"code","execution_count":2,"metadata":{},"outputs":[],"source":["from pandas import DataFrame\n","\n","\n","def feature_engineering(raw_df: DataFrame) -> DataFrame:\n"," \"\"\"\n"," Perform feature engineering on the input DataFrame.\n","\n"," Parameters:\n"," raw_df (DataFrame): The input DataFrame to be processed.\n","\n"," Returns:\n"," DataFrame: The processed DataFrame after feature engineering.\n"," \"\"\"\n"," df = raw_df.copy()\n","\n"," df = df[df['Deleted'].isna()]\n"," df['LapNumber'] = df['LapNumber'].astype(int)\n"," df = df.sort_values(by='LapNumber')\n","\n"," time_columns = ['LapTime', 'PitOutTime', 'PitInTime',\n"," 'Sector1Time', 'Sector2Time', 'Sector3Time', 'LapStartTime']\n"," for col in time_columns:\n"," if col in df.columns:\n"," df[col + 'Seconds'] = df[col].dt.total_seconds()\n"," df.drop(columns=[col], inplace=True, axis=1)\n"," print(f\"Converted {col} to seconds.\")\n","\n"," df.drop(columns=[col for col in ['Sector1SessionTime', 'Sector2SessionTime',\n"," 'Sector3SessionTime'] if col in df.columns], inplace=True, axis=1)\n","\n"," df['TimeInMinutes'] = df['Time'].dt.total_seconds() / 60\n"," df.drop(columns=['Time'], inplace=True, axis=1)\n","\n"," return df"]},{"cell_type":"code","execution_count":3,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["Converted LapTime to seconds.\n","Converted PitOutTime to seconds.\n","Converted PitInTime to seconds.\n","Converted Sector1Time to seconds.\n","Converted Sector2Time to seconds.\n","Converted Sector3Time to seconds.\n","Converted LapStartTime to seconds.\n","Converted LapTime to seconds.\n","Converted PitOutTime to seconds.\n","Converted PitInTime to seconds.\n","Converted Sector1Time to seconds.\n","Converted Sector2Time to seconds.\n","Converted Sector3Time to seconds.\n","Converted LapStartTime to seconds.\n","Converted LapTime to seconds.\n","Converted PitOutTime to seconds.\n","Converted PitInTime to seconds.\n","Converted Sector1Time to seconds.\n","Converted Sector2Time to seconds.\n","Converted Sector3Time to seconds.\n","Converted LapStartTime to seconds.\n","Converted LapTime to seconds.\n","Converted PitOutTime to seconds.\n","Converted PitInTime to seconds.\n","Converted Sector1Time to seconds.\n","Converted Sector2Time to seconds.\n","Converted Sector3Time to seconds.\n","Converted LapStartTime to seconds.\n"]}],"source":["hamilton_laps = feature_engineering(session.laps.pick_driver('HAM'))\n","russel_laps = feature_engineering(session.laps.pick_driver('RUS'))\n","verstappen_laps = feature_engineering(session.laps.pick_driver('VER'))\n","norris_laps = feature_engineering(session.laps.pick_driver('NOR'))"]},{"cell_type":"code","execution_count":4,"metadata":{},"outputs":[{"data":{"text/html":["
\n","\n","\n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n"," \n","
DriverDriverNumberLapNumberStintSpeedI1SpeedI2SpeedFLSpeedSTIsPersonalBestCompound...FastF1GeneratedIsAccurateLapTimeSecondsPitOutTimeSecondsPitInTimeSecondsSector1TimeSecondsSector2TimeSecondsSector3TimeSecondsLapStartTimeSecondsTimeInMinutes
368HAM4411.0215.0220.0281.0207.0FalseHARD...FalseFalseNaN855.834NaNNaN35.81724.869855.83416.018517
369HAM4421.0287.0287.0282.0316.0TrueHARD...FalseTrue77.632NaNNaN22.81531.37523.442961.11117.312383
370HAM4431.0124.0127.0NaN252.0FalseHARD...FalseFalse138.480NaN1174.5434.77660.31343.3911038.74319.620383
371HAM4442.0162.0209.0280.0149.0FalseHARD...FalseFalse138.9691202.155NaN60.71846.94031.3111177.22321.936533
372HAM4452.0288.0301.0280.0318.0TrueHARD...FalseTrue76.650NaNNaN22.56330.89023.1971316.19223.214033
\n","

5 rows × 28 columns

\n","
"],"text/plain":[" Driver DriverNumber LapNumber Stint SpeedI1 SpeedI2 SpeedFL SpeedST \\\n","368 HAM 44 1 1.0 215.0 220.0 281.0 207.0 \n","369 HAM 44 2 1.0 287.0 287.0 282.0 316.0 \n","370 HAM 44 3 1.0 124.0 127.0 NaN 252.0 \n","371 HAM 44 4 2.0 162.0 209.0 280.0 149.0 \n","372 HAM 44 5 2.0 288.0 301.0 280.0 318.0 \n","\n"," IsPersonalBest Compound ... FastF1Generated IsAccurate LapTimeSeconds \\\n","368 False HARD ... False False NaN \n","369 True HARD ... False True 77.632 \n","370 False HARD ... False False 138.480 \n","371 False HARD ... False False 138.969 \n","372 True HARD ... False True 76.650 \n","\n"," PitOutTimeSeconds PitInTimeSeconds Sector1TimeSeconds Sector2TimeSeconds \\\n","368 855.834 NaN NaN 35.817 \n","369 NaN NaN 22.815 31.375 \n","370 NaN 1174.54 34.776 60.313 \n","371 1202.155 NaN 60.718 46.940 \n","372 NaN NaN 22.563 30.890 \n","\n"," Sector3TimeSeconds LapStartTimeSeconds TimeInMinutes \n","368 24.869 855.834 16.018517 \n","369 23.442 961.111 17.312383 \n","370 43.391 1038.743 19.620383 \n","371 31.311 1177.223 21.936533 \n","372 23.197 1316.192 23.214033 \n","\n","[5 rows x 28 columns]"]},"execution_count":4,"metadata":{},"output_type":"execute_result"}],"source":["hamilton_laps.head()"]},{"cell_type":"markdown","metadata":{},"source":["## Saving to SQL Database\n","\n","https://python.langchain.com/v0.1/docs/use_cases/sql/\n"]},{"cell_type":"code","execution_count":5,"metadata":{},"outputs":[{"data":{"text/plain":["27"]},"execution_count":5,"metadata":{},"output_type":"execute_result"}],"source":["from sqlalchemy import create_engine\n","\n","GRAND_PRIX = 'Spain'\n","YEAR = 2024\n","SESSION = 'FP1'\n","\n","engine = create_engine(f'sqlite:///{GRAND_PRIX}_{YEAR}_{SESSION}.db')\n","\n","hamilton_laps.to_sql(name=\"hamilton\", con=engine)\n","russel_laps.to_sql(name=\"russel\", con=engine)\n","verstappen_laps.to_sql(name=\"verstappen\", con=engine)\n","norris_laps.to_sql(name=\"norris\", con=engine)"]},{"cell_type":"code","execution_count":12,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["[(368, 'HAM', '44', 1, 1.0, 215.0, 220.0, 281.0, 207.0, 0, 'HARD', 1.0, 1, 'Mercedes', '2024-06-21 11:30:16.280000', '1', None, None, '', 0, 0, None, 855.834, None, None, 35.817, 24.869, 855.834, 16.018516666666667), (456, 'RUS', '63', 1, 1.0, 208.0, 79.0, 282.0, 241.0, 0, 'HARD', 1.0, 1, 'Mercedes', '2024-06-21 11:30:18.645000', '1', None, None, '', 0, 0, None, 858.199, None, None, 37.699, 33.034, 858.199, 15.925883333333333), (457, 'RUS', '63', 2, 1.0, 275.0, 292.0, 285.0, 316.0, 1, 'HARD', 2.0, 1, 'Mercedes', '2024-06-21 11:31:55.999000', '1', None, None, '', 0, 1, 77.024, None, None, 22.713, 30.82, 23.491, 955.553, 17.209616666666665), (369, 'HAM', '44', 2, 1.0, 287.0, 287.0, 282.0, 316.0, 1, 'HARD', 2.0, 1, 'Mercedes', '2024-06-21 11:32:01.557000', '1', None, None, '', 0, 1, 77.632, None, None, 22.815, 31.375, 23.442, 961.111, 17.312383333333333), (458, 'RUS', '63', 3, 1.0, 128.0, 152.0, 280.0, 258.0, 0, 'HARD', 3.0, 1, 'Mercedes', '2024-06-21 11:33:13.023000', '1', None, None, '', 0, 1, 132.103, None, None, 38.542, 57.766, 35.795, 1032.577, 19.411333333333335), (370, 'HAM', '44', 3, 1.0, 124.0, 127.0, None, 252.0, 0, 'HARD', 3.0, 1, 'Mercedes', '2024-06-21 11:33:19.189000', '1', None, None, '', 0, 0, 138.48, None, 1174.54, 34.776, 60.313, 43.391, 1038.743, 19.620383333333333), (459, 'RUS', '63', 4, 1.0, 282.0, 291.0, 282.0, 318.0, 1, 'HARD', 4.0, 1, 'Mercedes', '2024-06-21 11:35:25.126000', '1', None, None, '', 0, 1, 75.868, None, None, 22.485, 30.537, 22.846, 1164.68, 20.6758), (371, 'HAM', '44', 4, 2.0, 162.0, 209.0, 280.0, 149.0, 0, 'HARD', 4.0, 0, 'Mercedes', '2024-06-21 11:35:37.669000', '1', None, None, '', 0, 0, 138.969, 1202.155, None, 60.718, 46.94, 31.311, 1177.223, 21.936533333333333), (460, 'RUS', '63', 5, 1.0, 178.0, 220.0, None, 276.0, 0, 'HARD', 5.0, 1, 'Mercedes', '2024-06-21 11:36:40.994000', '1', None, None, '', 0, 0, 114.638, None, 1352.485, 32.708, 46.244, 35.686, 1240.548, 22.586433333333332), (372, 'HAM', '44', 5, 2.0, 288.0, 301.0, 280.0, 318.0, 1, 'HARD', 5.0, 0, 'Mercedes', '2024-06-21 11:37:56.638000', '1', None, None, '', 0, 1, 76.65, None, None, 22.563, 30.89, 23.197, 1316.192, 23.214033333333337), (461, 'RUS', '63', 6, 2.0, 158.0, 193.0, 280.0, 144.0, 0, 'HARD', 6.0, 0, 'Mercedes', '2024-06-21 11:38:35.632000', '1', None, None, '', 0, 0, 148.324, 1387.823, None, 71.103, 45.84, 31.381, 1355.186, 25.0585), (373, 'HAM', '44', 6, 2.0, 125.0, 110.0, 282.0, 262.0, 0, 'HARD', 6.0, 0, 'Mercedes', '2024-06-21 11:39:13.288000', '1', None, None, '', 0, 1, 134.917, None, None, 38.007, 63.469, 33.441, 1392.842, 25.46265), (462, 'RUS', '63', 7, 2.0, 288.0, 297.0, 284.0, 313.0, 1, 'HARD', 7.0, 0, 'Mercedes', '2024-06-21 11:41:03.956000', '1', None, None, '', 0, 1, 75.692, None, None, 22.381, 30.512, 22.799, 1503.51, 26.320033333333335), (374, 'HAM', '44', 7, 2.0, 288.0, 303.0, 281.0, 315.0, 1, 'HARD', 7.0, 0, 'Mercedes', '2024-06-21 11:41:28.205000', '1', None, None, '', 0, 1, 76.203, None, None, 22.476, 30.863, 22.864, 1527.759, 26.7327), (463, 'RUS', '63', 8, 2.0, 132.0, 190.0, 190.0, 150.0, 0, 'HARD', 8.0, 0, 'Mercedes', '2024-06-21 11:42:19.648000', '1', None, None, '', 0, 1, 140.851, None, None, 42.611, 61.345, 36.895, 1579.202, 28.667550000000002), (375, 'HAM', '44', 8, 2.0, 102.0, 132.0, 280.0, 298.0, 0, 'HARD', 8.0, 0, 'Mercedes', '2024-06-21 11:42:44.408000', '1', None, None, '', 0, 1, 142.788, None, None, 37.938, 71.921, 32.929, 1603.962, 29.1125), (464, 'RUS', '63', 9, 2.0, 179.0, 233.0, 281.0, 277.0, 0, 'HARD', 9.0, 0, 'Mercedes', '2024-06-21 11:44:40.499000', '1', None, None, '', 0, 1, 111.772, None, None, 32.088, 45.577, 34.107, 1720.053, 30.530416666666667), (376, 'HAM', '44', 9, 2.0, 288.0, 307.0, 281.0, 316.0, 1, 'HARD', 9.0, 0, 'Mercedes', '2024-06-21 11:45:07.196000', '1', None, None, '', 0, 1, 76.079, None, None, 22.381, 30.719, 22.979, 1746.75, 30.380483333333334), (377, 'HAM', '44', 10, 2.0, 174.0, 230.0, None, 258.0, 0, 'HARD', 10.0, 0, 'Mercedes', '2024-06-21 11:46:23.275000', '1', None, None, '', 0, 0, 98.026, None, 1918.275, 31.475, 38.165, 28.386, 1822.829, 32.01425), (465, 'RUS', '63', 10, 2.0, 287.0, 299.0, 283.0, 315.0, 1, 'HARD', 10.0, 0, 'Mercedes', '2024-06-21 11:46:32.271000', '1', None, None, '', 0, 1, 75.563, None, None, 22.37, 30.351, 22.842, 1831.825, 31.7898), (378, 'HAM', '44', 11, 3.0, 206.0, 151.0, 283.0, 202.0, 0, 'MEDIUM', 1.0, 1, 'Mercedes', '2024-06-21 11:48:01.301000', '1', None, None, '', 0, 0, None, 2539.519, None, None, 41.524, 26.322, 1920.855, 43.96618333333333), (466, 'RUS', '63', 11, 2.0, 179.0, 237.0, None, 240.0, 0, 'HARD', 11.0, 0, 'Mercedes', '2024-06-21 11:47:47.834000', '1', None, None, '', 0, 0, 100.057, None, 2004.758, 28.927, 40.11, 31.02, 1907.388, 33.45741666666667), (467, 'RUS', '63', 12, 3.0, 224.0, 243.0, 281.0, 157.0, 0, 'MEDIUM', 1.0, 1, 'Mercedes', '2024-06-21 11:49:27.891000', '1', None, None, '', 0, 0, None, 2485.373, None, None, 40.206, 27.963, 2007.445, 43.125483333333335), (379, 'HAM', '44', 12, 3.0, 289.0, 309.0, 284.0, 320.0, 1, 'MEDIUM', 2.0, 1, 'Mercedes', '2024-06-21 11:59:58.417000', '1', None, None, '', 0, 1, 74.911, None, None, 22.049, 30.005, 22.857, 2637.971, 45.2147), (468, 'RUS', '63', 13, 3.0, 285.0, 306.0, 283.0, 311.0, 1, 'MEDIUM', 2.0, 1, 'Mercedes', '2024-06-21 11:59:07.975000', '1', None, None, '', 0, 1, 74.753, None, None, 22.3, 29.889, 22.564, 2587.529, 44.37136666666667), (380, 'HAM', '44', 13, 3.0, 119.0, 154.0, None, 301.0, 0, 'MEDIUM', 3.0, 1, 'Mercedes', '2024-06-21 12:01:13.328000', '1', None, None, '', 0, 0, 146.607, None, 2856.777, 38.139, 63.431, 45.037, 2712.882, 47.65815), (469, 'RUS', '63', 14, 3.0, 138.0, 150.0, 151.0, 137.0, 0, 'MEDIUM', 3.0, 1, 'Mercedes', '2024-06-21 12:00:22.728000', '1', None, None, '', 0, 1, 146.632, None, None, 44.358, 57.191, 45.083, 2662.282, 46.81523333333334), (381, 'HAM', '44', 14, 4.0, 112.0, 205.0, 283.0, 126.0, 0, 'MEDIUM', 4.0, 0, 'Mercedes', '2024-06-21 12:03:39.935000', '1', None, None, '', 0, 0, None, 2886.274, None, 74.776, 58.757, 29.366, 2859.489, 50.377316666666665), (470, 'RUS', '63', 15, 3.0, 118.0, 97.0, 281.0, 198.0, 0, 'MEDIUM', 4.0, 1, 'Mercedes', '2024-06-21 12:02:49.360000', '1', None, None, '', 0, 1, 135.035, None, None, 43.917, 57.054, 34.064, 2808.914, 49.06581666666667), (382, 'HAM', '44', 15, 4.0, 289.0, 226.0, None, 316.0, 0, 'MEDIUM', 5.0, 0, 'Mercedes', '2024-06-21 12:06:23.085000', '15', None, None, '', 0, 0, None, None, 3103.838, 22.202, 30.614, None, 3022.639, 59.48106666666667), (471, 'RUS', '63', 16, 3.0, 289.0, 308.0, 281.0, 313.0, 1, 'MEDIUM', 5.0, 1, 'Mercedes', '2024-06-21 12:05:04.395000', '1', None, None, '', 0, 1, 74.614, None, None, 22.212, 29.903, 22.499, 2943.949, 50.30938333333334), (383, 'HAM', '44', 16, 5.0, 268.0, 157.0, 272.0, 235.0, 0, 'MEDIUM', 6.0, 0, 'Mercedes', '2024-06-21 12:15:29.310000', '1', None, None, '', 0, 0, None, 3568.864, None, None, 33.914, 31.005, 3568.864, 61.247616666666666), (384, 'HAM', '44', 17, 5.0, 269.0, 264.0, 273.0, 295.0, 0, 'MEDIUM', 7.0, 0, 'Mercedes', '2024-06-21 12:17:15.303000', '1', None, None, '', 0, 1, 80.3, None, None, 24.169, 32.19, 23.941, 3674.857, 62.585950000000004), (472, 'RUS', '63', 17, 3.0, 163.0, 94.0, None, 177.0, 0, 'MEDIUM', 6.0, 1, 'Mercedes', '2024-06-21 12:06:19.009000', '15', None, None, '', 0, 0, None, None, 3143.256, 35.429, 48.11, None, 3018.563, 58.14718333333334), (473, 'RUS', '63', 18, 4.0, 256.0, 268.0, 269.0, 230.0, 0, 'HARD', 12.0, 0, 'Mercedes', '2024-06-21 12:14:09.277000', '1', None, None, '', 0, 0, None, 3488.831, None, None, 33.344, 27.129, 3488.831, 59.93285), (385, 'HAM', '44', 18, 5.0, 271.0, 272.0, 274.0, 302.0, 0, 'MEDIUM', 8.0, 0, 'Mercedes', '2024-06-21 12:18:35.603000', '1', None, None, '', 0, 1, 79.933, None, None, 23.627, 32.173, 24.133, 3755.157, 63.91816666666667), (474, 'RUS', '63', 19, 4.0, 272.0, 276.0, 274.0, 289.0, 0, 'HARD', 13.0, 0, 'Mercedes', '2024-06-21 12:15:56.417000', '1', None, None, '', 0, 1, 80.78, None, None, 24.289, 32.265, 24.226, 3595.971, 61.279183333333336), (386, 'HAM', '44', 19, 5.0, 275.0, 270.0, 278.0, 304.0, 0, 'MEDIUM', 9.0, 0, 'Mercedes', '2024-06-21 12:19:55.536000', '1', None, None, '', 0, 1, 80.114, None, None, 23.769, 32.242, 24.103, 3835.09, 65.2534), (387, 'HAM', '44', 20, 5.0, 276.0, 270.0, 278.0, 307.0, 0, 'MEDIUM', 10.0, 0, 'Mercedes', '2024-06-21 12:21:15.650000', '1', None, None, '', 0, 1, 80.399, None, None, 23.791, 32.414, 24.194, 3915.204, 66.59338333333334), (475, 'RUS', '63', 20, 4.0, 273.0, 255.0, 273.0, 298.0, 0, 'HARD', 14.0, 0, 'Mercedes', '2024-06-21 12:17:17.197000', '1', None, None, '', 0, 1, 83.024, None, None, 23.963, 32.48, 26.581, 3676.751, 62.66291666666667), (388, 'HAM', '44', 21, 5.0, 273.0, 160.0, 275.0, None, 0, 'MEDIUM', 11.0, 0, 'Mercedes', '2024-06-21 12:22:36.049000', '1', None, None, '', 0, 1, 84.782, None, None, 23.722, 34.074, 26.986, 3995.603, 68.00641666666667), (476, 'RUS', '63', 21, 4.0, 268.0, 274.0, 275.0, 301.0, 0, 'HARD', 15.0, 0, 'Mercedes', '2024-06-21 12:18:40.221000', '1', None, None, '', 0, 1, 81.062, None, None, 24.061, 32.573, 24.428, 3759.775, 64.01395), (389, 'HAM', '44', 22, 5.0, None, 268.0, 275.0, 303.0, 0, 'MEDIUM', 12.0, 0, 'Mercedes', '2024-06-21 12:24:00.831000', '1', None, None, '', 0, 1, 80.692, None, None, 23.638, 32.75, 24.304, 4080.385, 69.35128333333334), (477, 'RUS', '63', 22, 4.0, 272.0, 272.0, 277.0, 303.0, 0, 'HARD', 16.0, 0, 'Mercedes', '2024-06-21 12:20:01.283000', '1', None, None, '', 0, 1, 80.558, None, None, 23.96, 32.354, 24.244, 3840.837, 65.35658333333333), (390, 'HAM', '44', 23, 5.0, 275.0, 274.0, 273.0, 301.0, 0, 'MEDIUM', 13.0, 0, 'Mercedes', '2024-06-21 12:25:21.523000', '1', None, None, '', 0, 1, 81.582, None, None, 23.764, 32.576, 25.242, 4161.077, 70.71098333333333), (478, 'RUS', '63', 23, 4.0, 276.0, 271.0, None, 304.0, 0, 'HARD', 17.0, 0, 'Mercedes', '2024-06-21 12:21:21.841000', '1', None, None, '', 0, 0, 85.125, None, 4003.719, 23.783, 32.786, 28.556, 3921.395, 66.77533333333334), (391, 'HAM', '44', 24, 5.0, 278.0, 275.0, 275.0, 302.0, 0, 'MEDIUM', 14.0, 0, 'Mercedes', '2024-06-21 12:26:43.105000', '1', None, None, '', 0, 1, 81.299, None, None, 24.061, 32.758, 24.48, 4242.659, 72.06596666666665), (479, 'RUS', '63', 24, 5.0, 270.0, 269.0, 277.0, 249.0, 0, 'HARD', 18.0, 0, 'Mercedes', '2024-06-21 12:22:46.966000', '1', None, None, '', 0, 0, 106.574, 4030.111, None, 49.039, 33.223, 24.312, 4006.52, 68.55156666666667), (480, 'RUS', '63', 25, 5.0, 274.0, 277.0, 277.0, 298.0, 0, 'HARD', 19.0, 0, 'Mercedes', '2024-06-21 12:24:33.540000', '1', None, None, '', 0, 1, 81.085, None, None, 23.902, 32.787, 24.396, 4113.094, 69.90298333333334), (392, 'HAM', '44', 25, 5.0, 269.0, 247.0, 278.0, 303.0, 0, 'MEDIUM', 15.0, 0, 'Mercedes', '2024-06-21 12:28:04.404000', '1', None, None, '', 0, 1, 84.346, None, None, 24.494, 33.214, 26.638, 4323.958, 73.47173333333333), (393, 'HAM', '44', 26, 5.0, 276.0, 279.0, 275.0, 324.0, 0, 'MEDIUM', 16.0, 0, 'Mercedes', '2024-06-21 12:29:28.750000', '1', None, None, '', 0, 1, 80.92, None, None, 23.751, 32.744, 24.425, 4408.304, 74.8204), (481, 'RUS', '63', 26, 5.0, 270.0, 282.0, 278.0, 300.0, 0, 'HARD', 20.0, 0, 'Mercedes', '2024-06-21 12:25:54.625000', '1', None, None, '', 0, 1, 80.941, None, None, 23.989, 32.525, 24.427, 4194.179, 71.252), (394, 'HAM', '44', 27, 5.0, 148.0, 133.0, 15.0, 284.0, 0, 'MEDIUM', 17.0, 0, 'Mercedes', '2024-06-21 12:30:49.670000', '1', None, None, '', 0, 1, 137.31, None, None, 33.224, 51.297, 52.789, 4489.224, 77.10889999999999), (482, 'RUS', '63', 27, 5.0, 266.0, 280.0, 277.0, 321.0, 0, 'HARD', 21.0, 0, 'Mercedes', '2024-06-21 12:27:15.566000', '1', None, None, '', 0, 1, 81.028, None, None, 23.749, 32.77, 24.509, 4275.12, 72.60246666666667), (483, 'RUS', '63', 28, 5.0, 268.0, 278.0, 280.0, 303.0, 0, 'HARD', 22.0, 0, 'Mercedes', '2024-06-21 12:28:36.594000', '1', None, None, '', 0, 1, 81.183, None, None, 23.87, 32.863, 24.45, 4356.148, 73.95551666666667), (395, 'HAM', '44', 28, 5.0, 261.0, 270.0, None, 273.0, 0, 'MEDIUM', 18.0, 0, 'Mercedes', '2024-06-21 12:33:06.980000', '1', None, None, '', 0, 0, 122.684, None, 4746.487, 58.09, 35.919, 28.675, 4626.534, 79.15363333333333), (484, 'RUS', '63', 29, 5.0, 267.0, 269.0, 275.0, 324.0, 0, 'HARD', 23.0, 0, 'Mercedes', '2024-06-21 12:29:57.777000', '1', None, None, '', 0, 1, 81.52, None, None, 23.454, 33.259, 24.807, 4437.331, 75.31418333333333), (485, 'RUS', '63', 30, 5.0, 165.0, 150.0, 39.0, 208.0, 0, 'HARD', 24.0, 0, 'Mercedes', '2024-06-21 12:31:19.297000', '1', None, None, '', 0, 1, 129.533, None, None, 33.107, 45.718, 50.708, 4518.851, 77.47306666666667), (486, 'RUS', '63', 31, 5.0, 255.0, 249.0, None, 281.0, 0, 'HARD', 25.0, 0, 'Mercedes', '2024-06-21 12:33:28.830000', '1', None, None, '', 0, 0, 133.368, None, 4778.937, 56.732, 46.638, 29.998, 4648.384, 79.69586666666667)]\n"]}],"source":["from sqlalchemy import text\n","with engine.connect() as conn:\n"," res = conn.execute(text(\"SELECT * FROM laps\")).fetchall()\n","\n"," print(res)"]},{"cell_type":"code","execution_count":null,"metadata":{},"outputs":[],"source":[]}],"metadata":{"kernelspec":{"display_name":"formula-1","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.0"}},"nbformat":4,"nbformat_minor":2}