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"," Time | \n"," Driver | \n"," DriverNumber | \n"," LapTime | \n"," LapNumber | \n"," Stint | \n"," PitOutTime | \n"," PitInTime | \n"," Sector1Time | \n"," Sector2Time | \n"," ... | \n"," FreshTyre | \n"," Team | \n"," LapStartTime | \n"," LapStartDate | \n"," TrackStatus | \n"," Position | \n"," Deleted | \n"," DeletedReason | \n"," FastF1Generated | \n"," IsAccurate | \n","
\n"," \n"," \n"," \n"," 368 | \n"," 0 days 00:16:01.111000 | \n"," HAM | \n"," 44 | \n"," NaT | \n"," 1 | \n"," 1.0 | \n"," 0 days 00:14:15.834000 | \n"," NaT | \n"," NaT | \n"," 0 days 00:00:35.817000 | \n"," ... | \n"," True | \n"," Mercedes | \n"," 0 days 00:14:15.834000 | \n"," 2024-06-21 11:30:16.280 | \n"," 1 | \n"," NaN | \n"," None | \n"," | \n"," False | \n"," False | \n","
\n"," \n"," 456 | \n"," 0 days 00:15:55.553000 | \n"," RUS | \n"," 63 | \n"," NaT | \n"," 1 | \n"," 1.0 | \n"," 0 days 00:14:18.199000 | \n"," NaT | \n"," NaT | \n"," 0 days 00:00:37.699000 | \n"," ... | \n"," True | \n"," Mercedes | \n"," 0 days 00:14:18.199000 | \n"," 2024-06-21 11:30:18.645 | \n"," 1 | \n"," NaN | \n"," None | \n"," | \n"," False | \n"," False | \n","
\n"," \n"," 457 | \n"," 0 days 00:17:12.577000 | \n"," RUS | \n"," 63 | \n"," 0 days 00:01:17.024000 | \n"," 2 | \n"," 1.0 | \n"," NaT | \n"," NaT | \n"," 0 days 00:00:22.713000 | \n"," 0 days 00:00:30.820000 | \n"," ... | \n"," True | \n"," Mercedes | \n"," 0 days 00:15:55.553000 | \n"," 2024-06-21 11:31:55.999 | \n"," 1 | \n"," NaN | \n"," None | \n"," | \n"," False | \n"," True | \n","
\n"," \n"," 369 | \n"," 0 days 00:17:18.743000 | \n"," HAM | \n"," 44 | \n"," 0 days 00:01:17.632000 | \n"," 2 | \n"," 1.0 | \n"," NaT | \n"," NaT | \n"," 0 days 00:00:22.815000 | \n"," 0 days 00:00:31.375000 | \n"," ... | \n"," True | \n"," Mercedes | \n"," 0 days 00:16:01.111000 | \n"," 2024-06-21 11:32:01.557 | \n"," 1 | \n"," NaN | \n"," None | \n"," | \n"," False | \n"," True | \n","
\n"," \n"," 458 | \n"," 0 days 00:19:24.680000 | \n"," RUS | \n"," 63 | \n"," 0 days 00:02:12.103000 | \n"," 3 | \n"," 1.0 | \n"," NaT | \n"," NaT | \n"," 0 days 00:00:38.542000 | \n"," 0 days 00:00:57.766000 | \n"," ... | \n"," True | \n"," Mercedes | \n"," 0 days 00:17:12.577000 | \n"," 2024-06-21 11:33:13.023 | \n"," 1 | \n"," NaN | \n"," None | \n"," | \n"," False | \n"," True | \n","
\n"," \n","
\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"," Driver | \n"," DriverNumber | \n"," LapNumber | \n"," Stint | \n"," SpeedI1 | \n"," SpeedI2 | \n"," SpeedFL | \n"," SpeedST | \n"," IsPersonalBest | \n"," Compound | \n"," ... | \n"," FastF1Generated | \n"," IsAccurate | \n"," LapTimeSeconds | \n"," PitOutTimeSeconds | \n"," PitInTimeSeconds | \n"," Sector1TimeSeconds | \n"," Sector2TimeSeconds | \n"," Sector3TimeSeconds | \n"," LapStartTimeSeconds | \n"," TimeInMinutes | \n","
\n"," \n"," \n"," \n"," 368 | \n"," HAM | \n"," 44 | \n"," 1 | \n"," 1.0 | \n"," 215.0 | \n"," 220.0 | \n"," 281.0 | \n"," 207.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 855.834 | \n"," NaN | \n"," NaN | \n"," 35.817 | \n"," 24.869 | \n"," 855.834 | \n"," 16.018517 | \n","
\n"," \n"," 456 | \n"," RUS | \n"," 63 | \n"," 1 | \n"," 1.0 | \n"," 208.0 | \n"," 79.0 | \n"," 282.0 | \n"," 241.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 858.199 | \n"," NaN | \n"," NaN | \n"," 37.699 | \n"," 33.034 | \n"," 858.199 | \n"," 15.925883 | \n","
\n"," \n"," 457 | \n"," RUS | \n"," 63 | \n"," 2 | \n"," 1.0 | \n"," 275.0 | \n"," 292.0 | \n"," 285.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 77.024 | \n"," NaN | \n"," NaN | \n"," 22.713 | \n"," 30.820 | \n"," 23.491 | \n"," 955.553 | \n"," 17.209617 | \n","
\n"," \n"," 369 | \n"," HAM | \n"," 44 | \n"," 2 | \n"," 1.0 | \n"," 287.0 | \n"," 287.0 | \n"," 282.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 77.632 | \n"," NaN | \n"," NaN | \n"," 22.815 | \n"," 31.375 | \n"," 23.442 | \n"," 961.111 | \n"," 17.312383 | \n","
\n"," \n"," 458 | \n"," RUS | \n"," 63 | \n"," 3 | \n"," 1.0 | \n"," 128.0 | \n"," 152.0 | \n"," 280.0 | \n"," 258.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 132.103 | \n"," NaN | \n"," NaN | \n"," 38.542 | \n"," 57.766 | \n"," 35.795 | \n"," 1032.577 | \n"," 19.411333 | \n","
\n"," \n"," 370 | \n"," HAM | \n"," 44 | \n"," 3 | \n"," 1.0 | \n"," 124.0 | \n"," 127.0 | \n"," NaN | \n"," 252.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.480 | \n"," NaN | \n"," 1174.540 | \n"," 34.776 | \n"," 60.313 | \n"," 43.391 | \n"," 1038.743 | \n"," 19.620383 | \n","
\n"," \n"," 459 | \n"," RUS | \n"," 63 | \n"," 4 | \n"," 1.0 | \n"," 282.0 | \n"," 291.0 | \n"," 282.0 | \n"," 318.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.868 | \n"," NaN | \n"," NaN | \n"," 22.485 | \n"," 30.537 | \n"," 22.846 | \n"," 1164.680 | \n"," 20.675800 | \n","
\n"," \n"," 371 | \n"," HAM | \n"," 44 | \n"," 4 | \n"," 2.0 | \n"," 162.0 | \n"," 209.0 | \n"," 280.0 | \n"," 149.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.969 | \n"," 1202.155 | \n"," NaN | \n"," 60.718 | \n"," 46.940 | \n"," 31.311 | \n"," 1177.223 | \n"," 21.936533 | \n","
\n"," \n"," 460 | \n"," RUS | \n"," 63 | \n"," 5 | \n"," 1.0 | \n"," 178.0 | \n"," 220.0 | \n"," NaN | \n"," 276.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 114.638 | \n"," NaN | \n"," 1352.485 | \n"," 32.708 | \n"," 46.244 | \n"," 35.686 | \n"," 1240.548 | \n"," 22.586433 | \n","
\n"," \n"," 372 | \n"," HAM | \n"," 44 | \n"," 5 | \n"," 2.0 | \n"," 288.0 | \n"," 301.0 | \n"," 280.0 | \n"," 318.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.650 | \n"," NaN | \n"," NaN | \n"," 22.563 | \n"," 30.890 | \n"," 23.197 | \n"," 1316.192 | \n"," 23.214033 | \n","
\n"," \n"," 461 | \n"," RUS | \n"," 63 | \n"," 6 | \n"," 2.0 | \n"," 158.0 | \n"," 193.0 | \n"," 280.0 | \n"," 144.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 148.324 | \n"," 1387.823 | \n"," NaN | \n"," 71.103 | \n"," 45.840 | \n"," 31.381 | \n"," 1355.186 | \n"," 25.058500 | \n","
\n"," \n"," 373 | \n"," HAM | \n"," 44 | \n"," 6 | \n"," 2.0 | \n"," 125.0 | \n"," 110.0 | \n"," 282.0 | \n"," 262.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 134.917 | \n"," NaN | \n"," NaN | \n"," 38.007 | \n"," 63.469 | \n"," 33.441 | \n"," 1392.842 | \n"," 25.462650 | \n","
\n"," \n"," 462 | \n"," RUS | \n"," 63 | \n"," 7 | \n"," 2.0 | \n"," 288.0 | \n"," 297.0 | \n"," 284.0 | \n"," 313.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.692 | \n"," NaN | \n"," NaN | \n"," 22.381 | \n"," 30.512 | \n"," 22.799 | \n"," 1503.510 | \n"," 26.320033 | \n","
\n"," \n"," 374 | \n"," HAM | \n"," 44 | \n"," 7 | \n"," 2.0 | \n"," 288.0 | \n"," 303.0 | \n"," 281.0 | \n"," 315.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.203 | \n"," NaN | \n"," NaN | \n"," 22.476 | \n"," 30.863 | \n"," 22.864 | \n"," 1527.759 | \n"," 26.732700 | \n","
\n"," \n"," 463 | \n"," RUS | \n"," 63 | \n"," 8 | \n"," 2.0 | \n"," 132.0 | \n"," 190.0 | \n"," 190.0 | \n"," 150.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 140.851 | \n"," NaN | \n"," NaN | \n"," 42.611 | \n"," 61.345 | \n"," 36.895 | \n"," 1579.202 | \n"," 28.667550 | \n","
\n"," \n"," 375 | \n"," HAM | \n"," 44 | \n"," 8 | \n"," 2.0 | \n"," 102.0 | \n"," 132.0 | \n"," 280.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 142.788 | \n"," NaN | \n"," NaN | \n"," 37.938 | \n"," 71.921 | \n"," 32.929 | \n"," 1603.962 | \n"," 29.112500 | \n","
\n"," \n"," 464 | \n"," RUS | \n"," 63 | \n"," 9 | \n"," 2.0 | \n"," 179.0 | \n"," 233.0 | \n"," 281.0 | \n"," 277.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 111.772 | \n"," NaN | \n"," NaN | \n"," 32.088 | \n"," 45.577 | \n"," 34.107 | \n"," 1720.053 | \n"," 30.530417 | \n","
\n"," \n"," 376 | \n"," HAM | \n"," 44 | \n"," 9 | \n"," 2.0 | \n"," 288.0 | \n"," 307.0 | \n"," 281.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.079 | \n"," NaN | \n"," NaN | \n"," 22.381 | \n"," 30.719 | \n"," 22.979 | \n"," 1746.750 | \n"," 30.380483 | \n","
\n"," \n"," 377 | \n"," HAM | \n"," 44 | \n"," 10 | \n"," 2.0 | \n"," 174.0 | \n"," 230.0 | \n"," NaN | \n"," 258.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 98.026 | \n"," NaN | \n"," 1918.275 | \n"," 31.475 | \n"," 38.165 | \n"," 28.386 | \n"," 1822.829 | \n"," 32.014250 | \n","
\n"," \n"," 465 | \n"," RUS | \n"," 63 | \n"," 10 | \n"," 2.0 | \n"," 287.0 | \n"," 299.0 | \n"," 283.0 | \n"," 315.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.563 | \n"," NaN | \n"," NaN | \n"," 22.370 | \n"," 30.351 | \n"," 22.842 | \n"," 1831.825 | \n"," 31.789800 | \n","
\n"," \n"," 378 | \n"," HAM | \n"," 44 | \n"," 11 | \n"," 3.0 | \n"," 206.0 | \n"," 151.0 | \n"," 283.0 | \n"," 202.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2539.519 | \n"," NaN | \n"," NaN | \n"," 41.524 | \n"," 26.322 | \n"," 1920.855 | \n"," 43.966183 | \n","
\n"," \n"," 466 | \n"," RUS | \n"," 63 | \n"," 11 | \n"," 2.0 | \n"," 179.0 | \n"," 237.0 | \n"," NaN | \n"," 240.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 100.057 | \n"," NaN | \n"," 2004.758 | \n"," 28.927 | \n"," 40.110 | \n"," 31.020 | \n"," 1907.388 | \n"," 33.457417 | \n","
\n"," \n"," 467 | \n"," RUS | \n"," 63 | \n"," 12 | \n"," 3.0 | \n"," 224.0 | \n"," 243.0 | \n"," 281.0 | \n"," 157.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2485.373 | \n"," NaN | \n"," NaN | \n"," 40.206 | \n"," 27.963 | \n"," 2007.445 | \n"," 43.125483 | \n","
\n"," \n"," 379 | \n"," HAM | \n"," 44 | \n"," 12 | \n"," 3.0 | \n"," 289.0 | \n"," 309.0 | \n"," 284.0 | \n"," 320.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.911 | \n"," NaN | \n"," NaN | \n"," 22.049 | \n"," 30.005 | \n"," 22.857 | \n"," 2637.971 | \n"," 45.214700 | \n","
\n"," \n"," 468 | \n"," RUS | \n"," 63 | \n"," 13 | \n"," 3.0 | \n"," 285.0 | \n"," 306.0 | \n"," 283.0 | \n"," 311.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.753 | \n"," NaN | \n"," NaN | \n"," 22.300 | \n"," 29.889 | \n"," 22.564 | \n"," 2587.529 | \n"," 44.371367 | \n","
\n"," \n"," 380 | \n"," HAM | \n"," 44 | \n"," 13 | \n"," 3.0 | \n"," 119.0 | \n"," 154.0 | \n"," NaN | \n"," 301.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," 146.607 | \n"," NaN | \n"," 2856.777 | \n"," 38.139 | \n"," 63.431 | \n"," 45.037 | \n"," 2712.882 | \n"," 47.658150 | \n","
\n"," \n"," 469 | \n"," RUS | \n"," 63 | \n"," 14 | \n"," 3.0 | \n"," 138.0 | \n"," 150.0 | \n"," 151.0 | \n"," 137.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 146.632 | \n"," NaN | \n"," NaN | \n"," 44.358 | \n"," 57.191 | \n"," 45.083 | \n"," 2662.282 | \n"," 46.815233 | \n","
\n"," \n"," 381 | \n"," HAM | \n"," 44 | \n"," 14 | \n"," 4.0 | \n"," 112.0 | \n"," 205.0 | \n"," 283.0 | \n"," 126.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2886.274 | \n"," NaN | \n"," 74.776 | \n"," 58.757 | \n"," 29.366 | \n"," 2859.489 | \n"," 50.377317 | \n","
\n"," \n"," 470 | \n"," RUS | \n"," 63 | \n"," 15 | \n"," 3.0 | \n"," 118.0 | \n"," 97.0 | \n"," 281.0 | \n"," 198.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 135.035 | \n"," NaN | \n"," NaN | \n"," 43.917 | \n"," 57.054 | \n"," 34.064 | \n"," 2808.914 | \n"," 49.065817 | \n","
\n"," \n"," 382 | \n"," HAM | \n"," 44 | \n"," 15 | \n"," 4.0 | \n"," 289.0 | \n"," 226.0 | \n"," NaN | \n"," 316.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," NaN | \n"," 3103.838 | \n"," 22.202 | \n"," 30.614 | \n"," NaN | \n"," 3022.639 | \n"," 59.481067 | \n","
\n"," \n"," 471 | \n"," RUS | \n"," 63 | \n"," 16 | \n"," 3.0 | \n"," 289.0 | \n"," 308.0 | \n"," 281.0 | \n"," 313.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.614 | \n"," NaN | \n"," NaN | \n"," 22.212 | \n"," 29.903 | \n"," 22.499 | \n"," 2943.949 | \n"," 50.309383 | \n","
\n"," \n"," 383 | \n"," HAM | \n"," 44 | \n"," 16 | \n"," 5.0 | \n"," 268.0 | \n"," 157.0 | \n"," 272.0 | \n"," 235.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 3568.864 | \n"," NaN | \n"," NaN | \n"," 33.914 | \n"," 31.005 | \n"," 3568.864 | \n"," 61.247617 | \n","
\n"," \n"," 384 | \n"," HAM | \n"," 44 | \n"," 17 | \n"," 5.0 | \n"," 269.0 | \n"," 264.0 | \n"," 273.0 | \n"," 295.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.300 | \n"," NaN | \n"," NaN | \n"," 24.169 | \n"," 32.190 | \n"," 23.941 | \n"," 3674.857 | \n"," 62.585950 | \n","
\n"," \n"," 472 | \n"," RUS | \n"," 63 | \n"," 17 | \n"," 3.0 | \n"," 163.0 | \n"," 94.0 | \n"," NaN | \n"," 177.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," NaN | \n"," 3143.256 | \n"," 35.429 | \n"," 48.110 | \n"," NaN | \n"," 3018.563 | \n"," 58.147183 | \n","
\n"," \n"," 473 | \n"," RUS | \n"," 63 | \n"," 18 | \n"," 4.0 | \n"," 256.0 | \n"," 268.0 | \n"," 269.0 | \n"," 230.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 3488.831 | \n"," NaN | \n"," NaN | \n"," 33.344 | \n"," 27.129 | \n"," 3488.831 | \n"," 59.932850 | \n","
\n"," \n"," 385 | \n"," HAM | \n"," 44 | \n"," 18 | \n"," 5.0 | \n"," 271.0 | \n"," 272.0 | \n"," 274.0 | \n"," 302.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 79.933 | \n"," NaN | \n"," NaN | \n"," 23.627 | \n"," 32.173 | \n"," 24.133 | \n"," 3755.157 | \n"," 63.918167 | \n","
\n"," \n"," 474 | \n"," RUS | \n"," 63 | \n"," 19 | \n"," 4.0 | \n"," 272.0 | \n"," 276.0 | \n"," 274.0 | \n"," 289.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.780 | \n"," NaN | \n"," NaN | \n"," 24.289 | \n"," 32.265 | \n"," 24.226 | \n"," 3595.971 | \n"," 61.279183 | \n","
\n"," \n"," 386 | \n"," HAM | \n"," 44 | \n"," 19 | \n"," 5.0 | \n"," 275.0 | \n"," 270.0 | \n"," 278.0 | \n"," 304.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.114 | \n"," NaN | \n"," NaN | \n"," 23.769 | \n"," 32.242 | \n"," 24.103 | \n"," 3835.090 | \n"," 65.253400 | \n","
\n"," \n"," 387 | \n"," HAM | \n"," 44 | \n"," 20 | \n"," 5.0 | \n"," 276.0 | \n"," 270.0 | \n"," 278.0 | \n"," 307.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.399 | \n"," NaN | \n"," NaN | \n"," 23.791 | \n"," 32.414 | \n"," 24.194 | \n"," 3915.204 | \n"," 66.593383 | \n","
\n"," \n"," 475 | \n"," RUS | \n"," 63 | \n"," 20 | \n"," 4.0 | \n"," 273.0 | \n"," 255.0 | \n"," 273.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 83.024 | \n"," NaN | \n"," NaN | \n"," 23.963 | \n"," 32.480 | \n"," 26.581 | \n"," 3676.751 | \n"," 62.662917 | \n","
\n"," \n"," 388 | \n"," HAM | \n"," 44 | \n"," 21 | \n"," 5.0 | \n"," 273.0 | \n"," 160.0 | \n"," 275.0 | \n"," NaN | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 84.782 | \n"," NaN | \n"," NaN | \n"," 23.722 | \n"," 34.074 | \n"," 26.986 | \n"," 3995.603 | \n"," 68.006417 | \n","
\n"," \n"," 476 | \n"," RUS | \n"," 63 | \n"," 21 | \n"," 4.0 | \n"," 268.0 | \n"," 274.0 | \n"," 275.0 | \n"," 301.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.062 | \n"," NaN | \n"," NaN | \n"," 24.061 | \n"," 32.573 | \n"," 24.428 | \n"," 3759.775 | \n"," 64.013950 | \n","
\n"," \n"," 389 | \n"," HAM | \n"," 44 | \n"," 22 | \n"," 5.0 | \n"," NaN | \n"," 268.0 | \n"," 275.0 | \n"," 303.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.692 | \n"," NaN | \n"," NaN | \n"," 23.638 | \n"," 32.750 | \n"," 24.304 | \n"," 4080.385 | \n"," 69.351283 | \n","
\n"," \n"," 477 | \n"," RUS | \n"," 63 | \n"," 22 | \n"," 4.0 | \n"," 272.0 | \n"," 272.0 | \n"," 277.0 | \n"," 303.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.558 | \n"," NaN | \n"," NaN | \n"," 23.960 | \n"," 32.354 | \n"," 24.244 | \n"," 3840.837 | \n"," 65.356583 | \n","
\n"," \n"," 390 | \n"," HAM | \n"," 44 | \n"," 23 | \n"," 5.0 | \n"," 275.0 | \n"," 274.0 | \n"," 273.0 | \n"," 301.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 81.582 | \n"," NaN | \n"," NaN | \n"," 23.764 | \n"," 32.576 | \n"," 25.242 | \n"," 4161.077 | \n"," 70.710983 | \n","
\n"," \n"," 478 | \n"," RUS | \n"," 63 | \n"," 23 | \n"," 4.0 | \n"," 276.0 | \n"," 271.0 | \n"," NaN | \n"," 304.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 85.125 | \n"," NaN | \n"," 4003.719 | \n"," 23.783 | \n"," 32.786 | \n"," 28.556 | \n"," 3921.395 | \n"," 66.775333 | \n","
\n"," \n"," 391 | \n"," HAM | \n"," 44 | \n"," 24 | \n"," 5.0 | \n"," 278.0 | \n"," 275.0 | \n"," 275.0 | \n"," 302.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 81.299 | \n"," NaN | \n"," NaN | \n"," 24.061 | \n"," 32.758 | \n"," 24.480 | \n"," 4242.659 | \n"," 72.065967 | \n","
\n"," \n"," 479 | \n"," RUS | \n"," 63 | \n"," 24 | \n"," 5.0 | \n"," 270.0 | \n"," 269.0 | \n"," 277.0 | \n"," 249.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 106.574 | \n"," 4030.111 | \n"," NaN | \n"," 49.039 | \n"," 33.223 | \n"," 24.312 | \n"," 4006.520 | \n"," 68.551567 | \n","
\n"," \n"," 480 | \n"," RUS | \n"," 63 | \n"," 25 | \n"," 5.0 | \n"," 274.0 | \n"," 277.0 | \n"," 277.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.085 | \n"," NaN | \n"," NaN | \n"," 23.902 | \n"," 32.787 | \n"," 24.396 | \n"," 4113.094 | \n"," 69.902983 | \n","
\n"," \n"," 392 | \n"," HAM | \n"," 44 | \n"," 25 | \n"," 5.0 | \n"," 269.0 | \n"," 247.0 | \n"," 278.0 | \n"," 303.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 84.346 | \n"," NaN | \n"," NaN | \n"," 24.494 | \n"," 33.214 | \n"," 26.638 | \n"," 4323.958 | \n"," 73.471733 | \n","
\n"," \n"," 393 | \n"," HAM | \n"," 44 | \n"," 26 | \n"," 5.0 | \n"," 276.0 | \n"," 279.0 | \n"," 275.0 | \n"," 324.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.920 | \n"," NaN | \n"," NaN | \n"," 23.751 | \n"," 32.744 | \n"," 24.425 | \n"," 4408.304 | \n"," 74.820400 | \n","
\n"," \n"," 481 | \n"," RUS | \n"," 63 | \n"," 26 | \n"," 5.0 | \n"," 270.0 | \n"," 282.0 | \n"," 278.0 | \n"," 300.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.941 | \n"," NaN | \n"," NaN | \n"," 23.989 | \n"," 32.525 | \n"," 24.427 | \n"," 4194.179 | \n"," 71.252000 | \n","
\n"," \n"," 394 | \n"," HAM | \n"," 44 | \n"," 27 | \n"," 5.0 | \n"," 148.0 | \n"," 133.0 | \n"," 15.0 | \n"," 284.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 137.310 | \n"," NaN | \n"," NaN | \n"," 33.224 | \n"," 51.297 | \n"," 52.789 | \n"," 4489.224 | \n"," 77.108900 | \n","
\n"," \n"," 482 | \n"," RUS | \n"," 63 | \n"," 27 | \n"," 5.0 | \n"," 266.0 | \n"," 280.0 | \n"," 277.0 | \n"," 321.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.028 | \n"," NaN | \n"," NaN | \n"," 23.749 | \n"," 32.770 | \n"," 24.509 | \n"," 4275.120 | \n"," 72.602467 | \n","
\n"," \n"," 483 | \n"," RUS | \n"," 63 | \n"," 28 | \n"," 5.0 | \n"," 268.0 | \n"," 278.0 | \n"," 280.0 | \n"," 303.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.183 | \n"," NaN | \n"," NaN | \n"," 23.870 | \n"," 32.863 | \n"," 24.450 | \n"," 4356.148 | \n"," 73.955517 | \n","
\n"," \n"," 395 | \n"," HAM | \n"," 44 | \n"," 28 | \n"," 5.0 | \n"," 261.0 | \n"," 270.0 | \n"," NaN | \n"," 273.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," 122.684 | \n"," NaN | \n"," 4746.487 | \n"," 58.090 | \n"," 35.919 | \n"," 28.675 | \n"," 4626.534 | \n"," 79.153633 | \n","
\n"," \n"," 484 | \n"," RUS | \n"," 63 | \n"," 29 | \n"," 5.0 | \n"," 267.0 | \n"," 269.0 | \n"," 275.0 | \n"," 324.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.520 | \n"," NaN | \n"," NaN | \n"," 23.454 | \n"," 33.259 | \n"," 24.807 | \n"," 4437.331 | \n"," 75.314183 | \n","
\n"," \n"," 485 | \n"," RUS | \n"," 63 | \n"," 30 | \n"," 5.0 | \n"," 165.0 | \n"," 150.0 | \n"," 39.0 | \n"," 208.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 129.533 | \n"," NaN | \n"," NaN | \n"," 33.107 | \n"," 45.718 | \n"," 50.708 | \n"," 4518.851 | \n"," 77.473067 | \n","
\n"," \n"," 486 | \n"," RUS | \n"," 63 | \n"," 31 | \n"," 5.0 | \n"," 255.0 | \n"," 249.0 | \n"," NaN | \n"," 281.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 133.368 | \n"," NaN | \n"," 4778.937 | \n"," 56.732 | \n"," 46.638 | \n"," 29.998 | \n"," 4648.384 | \n"," 79.695867 | \n","
\n"," \n","
\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"," Driver | \n"," DriverNumber | \n"," LapNumber | \n"," Stint | \n"," SpeedI1 | \n"," SpeedI2 | \n"," SpeedFL | \n"," SpeedST | \n"," IsPersonalBest | \n"," Compound | \n"," ... | \n"," FastF1Generated | \n"," IsAccurate | \n"," LapTimeSeconds | \n"," PitOutTimeSeconds | \n"," PitInTimeSeconds | \n"," Sector1TimeSeconds | \n"," Sector2TimeSeconds | \n"," Sector3TimeSeconds | \n"," LapStartTimeSeconds | \n"," TimeInMinutes | \n","
\n"," \n"," \n"," \n"," 368 | \n"," HAM | \n"," 44 | \n"," 1 | \n"," 1.0 | \n"," 215.0 | \n"," 220.0 | \n"," 281.0 | \n"," 207.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 855.834 | \n"," NaN | \n"," NaN | \n"," 35.817 | \n"," 24.869 | \n"," 855.834 | \n"," 16.018517 | \n","
\n"," \n"," 456 | \n"," RUS | \n"," 63 | \n"," 1 | \n"," 1.0 | \n"," 208.0 | \n"," 79.0 | \n"," 282.0 | \n"," 241.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 858.199 | \n"," NaN | \n"," NaN | \n"," 37.699 | \n"," 33.034 | \n"," 858.199 | \n"," 15.925883 | \n","
\n"," \n"," 457 | \n"," RUS | \n"," 63 | \n"," 2 | \n"," 1.0 | \n"," 275.0 | \n"," 292.0 | \n"," 285.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 77.024 | \n"," NaN | \n"," NaN | \n"," 22.713 | \n"," 30.820 | \n"," 23.491 | \n"," 955.553 | \n"," 17.209617 | \n","
\n"," \n"," 369 | \n"," HAM | \n"," 44 | \n"," 2 | \n"," 1.0 | \n"," 287.0 | \n"," 287.0 | \n"," 282.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 77.632 | \n"," NaN | \n"," NaN | \n"," 22.815 | \n"," 31.375 | \n"," 23.442 | \n"," 961.111 | \n"," 17.312383 | \n","
\n"," \n"," 458 | \n"," RUS | \n"," 63 | \n"," 3 | \n"," 1.0 | \n"," 128.0 | \n"," 152.0 | \n"," 280.0 | \n"," 258.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 132.103 | \n"," NaN | \n"," NaN | \n"," 38.542 | \n"," 57.766 | \n"," 35.795 | \n"," 1032.577 | \n"," 19.411333 | \n","
\n"," \n"," 370 | \n"," HAM | \n"," 44 | \n"," 3 | \n"," 1.0 | \n"," 124.0 | \n"," 127.0 | \n"," NaN | \n"," 252.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.480 | \n"," NaN | \n"," 1174.540 | \n"," 34.776 | \n"," 60.313 | \n"," 43.391 | \n"," 1038.743 | \n"," 19.620383 | \n","
\n"," \n"," 459 | \n"," RUS | \n"," 63 | \n"," 4 | \n"," 1.0 | \n"," 282.0 | \n"," 291.0 | \n"," 282.0 | \n"," 318.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.868 | \n"," NaN | \n"," NaN | \n"," 22.485 | \n"," 30.537 | \n"," 22.846 | \n"," 1164.680 | \n"," 20.675800 | \n","
\n"," \n"," 371 | \n"," HAM | \n"," 44 | \n"," 4 | \n"," 2.0 | \n"," 162.0 | \n"," 209.0 | \n"," 280.0 | \n"," 149.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.969 | \n"," 1202.155 | \n"," NaN | \n"," 60.718 | \n"," 46.940 | \n"," 31.311 | \n"," 1177.223 | \n"," 21.936533 | \n","
\n"," \n"," 460 | \n"," RUS | \n"," 63 | \n"," 5 | \n"," 1.0 | \n"," 178.0 | \n"," 220.0 | \n"," NaN | \n"," 276.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 114.638 | \n"," NaN | \n"," 1352.485 | \n"," 32.708 | \n"," 46.244 | \n"," 35.686 | \n"," 1240.548 | \n"," 22.586433 | \n","
\n"," \n"," 372 | \n"," HAM | \n"," 44 | \n"," 5 | \n"," 2.0 | \n"," 288.0 | \n"," 301.0 | \n"," 280.0 | \n"," 318.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.650 | \n"," NaN | \n"," NaN | \n"," 22.563 | \n"," 30.890 | \n"," 23.197 | \n"," 1316.192 | \n"," 23.214033 | \n","
\n"," \n"," 461 | \n"," RUS | \n"," 63 | \n"," 6 | \n"," 2.0 | \n"," 158.0 | \n"," 193.0 | \n"," 280.0 | \n"," 144.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 148.324 | \n"," 1387.823 | \n"," NaN | \n"," 71.103 | \n"," 45.840 | \n"," 31.381 | \n"," 1355.186 | \n"," 25.058500 | \n","
\n"," \n"," 373 | \n"," HAM | \n"," 44 | \n"," 6 | \n"," 2.0 | \n"," 125.0 | \n"," 110.0 | \n"," 282.0 | \n"," 262.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 134.917 | \n"," NaN | \n"," NaN | \n"," 38.007 | \n"," 63.469 | \n"," 33.441 | \n"," 1392.842 | \n"," 25.462650 | \n","
\n"," \n"," 462 | \n"," RUS | \n"," 63 | \n"," 7 | \n"," 2.0 | \n"," 288.0 | \n"," 297.0 | \n"," 284.0 | \n"," 313.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.692 | \n"," NaN | \n"," NaN | \n"," 22.381 | \n"," 30.512 | \n"," 22.799 | \n"," 1503.510 | \n"," 26.320033 | \n","
\n"," \n"," 374 | \n"," HAM | \n"," 44 | \n"," 7 | \n"," 2.0 | \n"," 288.0 | \n"," 303.0 | \n"," 281.0 | \n"," 315.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.203 | \n"," NaN | \n"," NaN | \n"," 22.476 | \n"," 30.863 | \n"," 22.864 | \n"," 1527.759 | \n"," 26.732700 | \n","
\n"," \n"," 463 | \n"," RUS | \n"," 63 | \n"," 8 | \n"," 2.0 | \n"," 132.0 | \n"," 190.0 | \n"," 190.0 | \n"," 150.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 140.851 | \n"," NaN | \n"," NaN | \n"," 42.611 | \n"," 61.345 | \n"," 36.895 | \n"," 1579.202 | \n"," 28.667550 | \n","
\n"," \n"," 375 | \n"," HAM | \n"," 44 | \n"," 8 | \n"," 2.0 | \n"," 102.0 | \n"," 132.0 | \n"," 280.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 142.788 | \n"," NaN | \n"," NaN | \n"," 37.938 | \n"," 71.921 | \n"," 32.929 | \n"," 1603.962 | \n"," 29.112500 | \n","
\n"," \n"," 464 | \n"," RUS | \n"," 63 | \n"," 9 | \n"," 2.0 | \n"," 179.0 | \n"," 233.0 | \n"," 281.0 | \n"," 277.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 111.772 | \n"," NaN | \n"," NaN | \n"," 32.088 | \n"," 45.577 | \n"," 34.107 | \n"," 1720.053 | \n"," 30.530417 | \n","
\n"," \n"," 376 | \n"," HAM | \n"," 44 | \n"," 9 | \n"," 2.0 | \n"," 288.0 | \n"," 307.0 | \n"," 281.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.079 | \n"," NaN | \n"," NaN | \n"," 22.381 | \n"," 30.719 | \n"," 22.979 | \n"," 1746.750 | \n"," 30.380483 | \n","
\n"," \n"," 377 | \n"," HAM | \n"," 44 | \n"," 10 | \n"," 2.0 | \n"," 174.0 | \n"," 230.0 | \n"," NaN | \n"," 258.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 98.026 | \n"," NaN | \n"," 1918.275 | \n"," 31.475 | \n"," 38.165 | \n"," 28.386 | \n"," 1822.829 | \n"," 32.014250 | \n","
\n"," \n"," 465 | \n"," RUS | \n"," 63 | \n"," 10 | \n"," 2.0 | \n"," 287.0 | \n"," 299.0 | \n"," 283.0 | \n"," 315.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 75.563 | \n"," NaN | \n"," NaN | \n"," 22.370 | \n"," 30.351 | \n"," 22.842 | \n"," 1831.825 | \n"," 31.789800 | \n","
\n"," \n"," 378 | \n"," HAM | \n"," 44 | \n"," 11 | \n"," 3.0 | \n"," 206.0 | \n"," 151.0 | \n"," 283.0 | \n"," 202.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2539.519 | \n"," NaN | \n"," NaN | \n"," 41.524 | \n"," 26.322 | \n"," 1920.855 | \n"," 43.966183 | \n","
\n"," \n"," 466 | \n"," RUS | \n"," 63 | \n"," 11 | \n"," 2.0 | \n"," 179.0 | \n"," 237.0 | \n"," NaN | \n"," 240.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 100.057 | \n"," NaN | \n"," 2004.758 | \n"," 28.927 | \n"," 40.110 | \n"," 31.020 | \n"," 1907.388 | \n"," 33.457417 | \n","
\n"," \n"," 467 | \n"," RUS | \n"," 63 | \n"," 12 | \n"," 3.0 | \n"," 224.0 | \n"," 243.0 | \n"," 281.0 | \n"," 157.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2485.373 | \n"," NaN | \n"," NaN | \n"," 40.206 | \n"," 27.963 | \n"," 2007.445 | \n"," 43.125483 | \n","
\n"," \n"," 379 | \n"," HAM | \n"," 44 | \n"," 12 | \n"," 3.0 | \n"," 289.0 | \n"," 309.0 | \n"," 284.0 | \n"," 320.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.911 | \n"," NaN | \n"," NaN | \n"," 22.049 | \n"," 30.005 | \n"," 22.857 | \n"," 2637.971 | \n"," 45.214700 | \n","
\n"," \n"," 468 | \n"," RUS | \n"," 63 | \n"," 13 | \n"," 3.0 | \n"," 285.0 | \n"," 306.0 | \n"," 283.0 | \n"," 311.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.753 | \n"," NaN | \n"," NaN | \n"," 22.300 | \n"," 29.889 | \n"," 22.564 | \n"," 2587.529 | \n"," 44.371367 | \n","
\n"," \n"," 380 | \n"," HAM | \n"," 44 | \n"," 13 | \n"," 3.0 | \n"," 119.0 | \n"," 154.0 | \n"," NaN | \n"," 301.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," 146.607 | \n"," NaN | \n"," 2856.777 | \n"," 38.139 | \n"," 63.431 | \n"," 45.037 | \n"," 2712.882 | \n"," 47.658150 | \n","
\n"," \n"," 469 | \n"," RUS | \n"," 63 | \n"," 14 | \n"," 3.0 | \n"," 138.0 | \n"," 150.0 | \n"," 151.0 | \n"," 137.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 146.632 | \n"," NaN | \n"," NaN | \n"," 44.358 | \n"," 57.191 | \n"," 45.083 | \n"," 2662.282 | \n"," 46.815233 | \n","
\n"," \n"," 381 | \n"," HAM | \n"," 44 | \n"," 14 | \n"," 4.0 | \n"," 112.0 | \n"," 205.0 | \n"," 283.0 | \n"," 126.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 2886.274 | \n"," NaN | \n"," 74.776 | \n"," 58.757 | \n"," 29.366 | \n"," 2859.489 | \n"," 50.377317 | \n","
\n"," \n"," 470 | \n"," RUS | \n"," 63 | \n"," 15 | \n"," 3.0 | \n"," 118.0 | \n"," 97.0 | \n"," 281.0 | \n"," 198.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 135.035 | \n"," NaN | \n"," NaN | \n"," 43.917 | \n"," 57.054 | \n"," 34.064 | \n"," 2808.914 | \n"," 49.065817 | \n","
\n"," \n"," 382 | \n"," HAM | \n"," 44 | \n"," 15 | \n"," 4.0 | \n"," 289.0 | \n"," 226.0 | \n"," NaN | \n"," 316.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," NaN | \n"," 3103.838 | \n"," 22.202 | \n"," 30.614 | \n"," NaN | \n"," 3022.639 | \n"," 59.481067 | \n","
\n"," \n"," 471 | \n"," RUS | \n"," 63 | \n"," 16 | \n"," 3.0 | \n"," 289.0 | \n"," 308.0 | \n"," 281.0 | \n"," 313.0 | \n"," True | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 74.614 | \n"," NaN | \n"," NaN | \n"," 22.212 | \n"," 29.903 | \n"," 22.499 | \n"," 2943.949 | \n"," 50.309383 | \n","
\n"," \n"," 383 | \n"," HAM | \n"," 44 | \n"," 16 | \n"," 5.0 | \n"," 268.0 | \n"," 157.0 | \n"," 272.0 | \n"," 235.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 3568.864 | \n"," NaN | \n"," NaN | \n"," 33.914 | \n"," 31.005 | \n"," 3568.864 | \n"," 61.247617 | \n","
\n"," \n"," 384 | \n"," HAM | \n"," 44 | \n"," 17 | \n"," 5.0 | \n"," 269.0 | \n"," 264.0 | \n"," 273.0 | \n"," 295.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.300 | \n"," NaN | \n"," NaN | \n"," 24.169 | \n"," 32.190 | \n"," 23.941 | \n"," 3674.857 | \n"," 62.585950 | \n","
\n"," \n"," 472 | \n"," RUS | \n"," 63 | \n"," 17 | \n"," 3.0 | \n"," 163.0 | \n"," 94.0 | \n"," NaN | \n"," 177.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," NaN | \n"," 3143.256 | \n"," 35.429 | \n"," 48.110 | \n"," NaN | \n"," 3018.563 | \n"," 58.147183 | \n","
\n"," \n"," 473 | \n"," RUS | \n"," 63 | \n"," 18 | \n"," 4.0 | \n"," 256.0 | \n"," 268.0 | \n"," 269.0 | \n"," 230.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 3488.831 | \n"," NaN | \n"," NaN | \n"," 33.344 | \n"," 27.129 | \n"," 3488.831 | \n"," 59.932850 | \n","
\n"," \n"," 385 | \n"," HAM | \n"," 44 | \n"," 18 | \n"," 5.0 | \n"," 271.0 | \n"," 272.0 | \n"," 274.0 | \n"," 302.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 79.933 | \n"," NaN | \n"," NaN | \n"," 23.627 | \n"," 32.173 | \n"," 24.133 | \n"," 3755.157 | \n"," 63.918167 | \n","
\n"," \n"," 474 | \n"," RUS | \n"," 63 | \n"," 19 | \n"," 4.0 | \n"," 272.0 | \n"," 276.0 | \n"," 274.0 | \n"," 289.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.780 | \n"," NaN | \n"," NaN | \n"," 24.289 | \n"," 32.265 | \n"," 24.226 | \n"," 3595.971 | \n"," 61.279183 | \n","
\n"," \n"," 386 | \n"," HAM | \n"," 44 | \n"," 19 | \n"," 5.0 | \n"," 275.0 | \n"," 270.0 | \n"," 278.0 | \n"," 304.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.114 | \n"," NaN | \n"," NaN | \n"," 23.769 | \n"," 32.242 | \n"," 24.103 | \n"," 3835.090 | \n"," 65.253400 | \n","
\n"," \n"," 387 | \n"," HAM | \n"," 44 | \n"," 20 | \n"," 5.0 | \n"," 276.0 | \n"," 270.0 | \n"," 278.0 | \n"," 307.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.399 | \n"," NaN | \n"," NaN | \n"," 23.791 | \n"," 32.414 | \n"," 24.194 | \n"," 3915.204 | \n"," 66.593383 | \n","
\n"," \n"," 475 | \n"," RUS | \n"," 63 | \n"," 20 | \n"," 4.0 | \n"," 273.0 | \n"," 255.0 | \n"," 273.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 83.024 | \n"," NaN | \n"," NaN | \n"," 23.963 | \n"," 32.480 | \n"," 26.581 | \n"," 3676.751 | \n"," 62.662917 | \n","
\n"," \n"," 388 | \n"," HAM | \n"," 44 | \n"," 21 | \n"," 5.0 | \n"," 273.0 | \n"," 160.0 | \n"," 275.0 | \n"," NaN | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 84.782 | \n"," NaN | \n"," NaN | \n"," 23.722 | \n"," 34.074 | \n"," 26.986 | \n"," 3995.603 | \n"," 68.006417 | \n","
\n"," \n"," 476 | \n"," RUS | \n"," 63 | \n"," 21 | \n"," 4.0 | \n"," 268.0 | \n"," 274.0 | \n"," 275.0 | \n"," 301.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.062 | \n"," NaN | \n"," NaN | \n"," 24.061 | \n"," 32.573 | \n"," 24.428 | \n"," 3759.775 | \n"," 64.013950 | \n","
\n"," \n"," 389 | \n"," HAM | \n"," 44 | \n"," 22 | \n"," 5.0 | \n"," NaN | \n"," 268.0 | \n"," 275.0 | \n"," 303.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.692 | \n"," NaN | \n"," NaN | \n"," 23.638 | \n"," 32.750 | \n"," 24.304 | \n"," 4080.385 | \n"," 69.351283 | \n","
\n"," \n"," 477 | \n"," RUS | \n"," 63 | \n"," 22 | \n"," 4.0 | \n"," 272.0 | \n"," 272.0 | \n"," 277.0 | \n"," 303.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.558 | \n"," NaN | \n"," NaN | \n"," 23.960 | \n"," 32.354 | \n"," 24.244 | \n"," 3840.837 | \n"," 65.356583 | \n","
\n"," \n"," 390 | \n"," HAM | \n"," 44 | \n"," 23 | \n"," 5.0 | \n"," 275.0 | \n"," 274.0 | \n"," 273.0 | \n"," 301.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 81.582 | \n"," NaN | \n"," NaN | \n"," 23.764 | \n"," 32.576 | \n"," 25.242 | \n"," 4161.077 | \n"," 70.710983 | \n","
\n"," \n"," 478 | \n"," RUS | \n"," 63 | \n"," 23 | \n"," 4.0 | \n"," 276.0 | \n"," 271.0 | \n"," NaN | \n"," 304.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 85.125 | \n"," NaN | \n"," 4003.719 | \n"," 23.783 | \n"," 32.786 | \n"," 28.556 | \n"," 3921.395 | \n"," 66.775333 | \n","
\n"," \n"," 391 | \n"," HAM | \n"," 44 | \n"," 24 | \n"," 5.0 | \n"," 278.0 | \n"," 275.0 | \n"," 275.0 | \n"," 302.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 81.299 | \n"," NaN | \n"," NaN | \n"," 24.061 | \n"," 32.758 | \n"," 24.480 | \n"," 4242.659 | \n"," 72.065967 | \n","
\n"," \n"," 479 | \n"," RUS | \n"," 63 | \n"," 24 | \n"," 5.0 | \n"," 270.0 | \n"," 269.0 | \n"," 277.0 | \n"," 249.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 106.574 | \n"," 4030.111 | \n"," NaN | \n"," 49.039 | \n"," 33.223 | \n"," 24.312 | \n"," 4006.520 | \n"," 68.551567 | \n","
\n"," \n"," 480 | \n"," RUS | \n"," 63 | \n"," 25 | \n"," 5.0 | \n"," 274.0 | \n"," 277.0 | \n"," 277.0 | \n"," 298.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.085 | \n"," NaN | \n"," NaN | \n"," 23.902 | \n"," 32.787 | \n"," 24.396 | \n"," 4113.094 | \n"," 69.902983 | \n","
\n"," \n"," 392 | \n"," HAM | \n"," 44 | \n"," 25 | \n"," 5.0 | \n"," 269.0 | \n"," 247.0 | \n"," 278.0 | \n"," 303.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 84.346 | \n"," NaN | \n"," NaN | \n"," 24.494 | \n"," 33.214 | \n"," 26.638 | \n"," 4323.958 | \n"," 73.471733 | \n","
\n"," \n"," 393 | \n"," HAM | \n"," 44 | \n"," 26 | \n"," 5.0 | \n"," 276.0 | \n"," 279.0 | \n"," 275.0 | \n"," 324.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 80.920 | \n"," NaN | \n"," NaN | \n"," 23.751 | \n"," 32.744 | \n"," 24.425 | \n"," 4408.304 | \n"," 74.820400 | \n","
\n"," \n"," 481 | \n"," RUS | \n"," 63 | \n"," 26 | \n"," 5.0 | \n"," 270.0 | \n"," 282.0 | \n"," 278.0 | \n"," 300.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 80.941 | \n"," NaN | \n"," NaN | \n"," 23.989 | \n"," 32.525 | \n"," 24.427 | \n"," 4194.179 | \n"," 71.252000 | \n","
\n"," \n"," 394 | \n"," HAM | \n"," 44 | \n"," 27 | \n"," 5.0 | \n"," 148.0 | \n"," 133.0 | \n"," 15.0 | \n"," 284.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," True | \n"," 137.310 | \n"," NaN | \n"," NaN | \n"," 33.224 | \n"," 51.297 | \n"," 52.789 | \n"," 4489.224 | \n"," 77.108900 | \n","
\n"," \n"," 482 | \n"," RUS | \n"," 63 | \n"," 27 | \n"," 5.0 | \n"," 266.0 | \n"," 280.0 | \n"," 277.0 | \n"," 321.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.028 | \n"," NaN | \n"," NaN | \n"," 23.749 | \n"," 32.770 | \n"," 24.509 | \n"," 4275.120 | \n"," 72.602467 | \n","
\n"," \n"," 483 | \n"," RUS | \n"," 63 | \n"," 28 | \n"," 5.0 | \n"," 268.0 | \n"," 278.0 | \n"," 280.0 | \n"," 303.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.183 | \n"," NaN | \n"," NaN | \n"," 23.870 | \n"," 32.863 | \n"," 24.450 | \n"," 4356.148 | \n"," 73.955517 | \n","
\n"," \n"," 395 | \n"," HAM | \n"," 44 | \n"," 28 | \n"," 5.0 | \n"," 261.0 | \n"," 270.0 | \n"," NaN | \n"," 273.0 | \n"," False | \n"," MEDIUM | \n"," ... | \n"," False | \n"," False | \n"," 122.684 | \n"," NaN | \n"," 4746.487 | \n"," 58.090 | \n"," 35.919 | \n"," 28.675 | \n"," 4626.534 | \n"," 79.153633 | \n","
\n"," \n"," 484 | \n"," RUS | \n"," 63 | \n"," 29 | \n"," 5.0 | \n"," 267.0 | \n"," 269.0 | \n"," 275.0 | \n"," 324.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 81.520 | \n"," NaN | \n"," NaN | \n"," 23.454 | \n"," 33.259 | \n"," 24.807 | \n"," 4437.331 | \n"," 75.314183 | \n","
\n"," \n"," 485 | \n"," RUS | \n"," 63 | \n"," 30 | \n"," 5.0 | \n"," 165.0 | \n"," 150.0 | \n"," 39.0 | \n"," 208.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 129.533 | \n"," NaN | \n"," NaN | \n"," 33.107 | \n"," 45.718 | \n"," 50.708 | \n"," 4518.851 | \n"," 77.473067 | \n","
\n"," \n"," 486 | \n"," RUS | \n"," 63 | \n"," 31 | \n"," 5.0 | \n"," 255.0 | \n"," 249.0 | \n"," NaN | \n"," 281.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 133.368 | \n"," NaN | \n"," 4778.937 | \n"," 56.732 | \n"," 46.638 | \n"," 29.998 | \n"," 4648.384 | \n"," 79.695867 | \n","
\n"," \n","
\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"," Driver | \n"," DriverNumber | \n"," LapNumber | \n"," Stint | \n"," SpeedI1 | \n"," SpeedI2 | \n"," SpeedFL | \n"," SpeedST | \n"," IsPersonalBest | \n"," Compound | \n"," ... | \n"," FastF1Generated | \n"," IsAccurate | \n"," LapTimeSeconds | \n"," PitOutTimeSeconds | \n"," PitInTimeSeconds | \n"," Sector1TimeSeconds | \n"," Sector2TimeSeconds | \n"," Sector3TimeSeconds | \n"," LapStartTimeSeconds | \n"," TimeInMinutes | \n","
\n"," \n"," \n"," \n"," 368 | \n"," HAM | \n"," 44 | \n"," 1 | \n"," 1.0 | \n"," 215.0 | \n"," 220.0 | \n"," 281.0 | \n"," 207.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," NaN | \n"," 855.834 | \n"," NaN | \n"," NaN | \n"," 35.817 | \n"," 24.869 | \n"," 855.834 | \n"," 16.018517 | \n","
\n"," \n"," 369 | \n"," HAM | \n"," 44 | \n"," 2 | \n"," 1.0 | \n"," 287.0 | \n"," 287.0 | \n"," 282.0 | \n"," 316.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 77.632 | \n"," NaN | \n"," NaN | \n"," 22.815 | \n"," 31.375 | \n"," 23.442 | \n"," 961.111 | \n"," 17.312383 | \n","
\n"," \n"," 370 | \n"," HAM | \n"," 44 | \n"," 3 | \n"," 1.0 | \n"," 124.0 | \n"," 127.0 | \n"," NaN | \n"," 252.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.480 | \n"," NaN | \n"," 1174.54 | \n"," 34.776 | \n"," 60.313 | \n"," 43.391 | \n"," 1038.743 | \n"," 19.620383 | \n","
\n"," \n"," 371 | \n"," HAM | \n"," 44 | \n"," 4 | \n"," 2.0 | \n"," 162.0 | \n"," 209.0 | \n"," 280.0 | \n"," 149.0 | \n"," False | \n"," HARD | \n"," ... | \n"," False | \n"," False | \n"," 138.969 | \n"," 1202.155 | \n"," NaN | \n"," 60.718 | \n"," 46.940 | \n"," 31.311 | \n"," 1177.223 | \n"," 21.936533 | \n","
\n"," \n"," 372 | \n"," HAM | \n"," 44 | \n"," 5 | \n"," 2.0 | \n"," 288.0 | \n"," 301.0 | \n"," 280.0 | \n"," 318.0 | \n"," True | \n"," HARD | \n"," ... | \n"," False | \n"," True | \n"," 76.650 | \n"," NaN | \n"," NaN | \n"," 22.563 | \n"," 30.890 | \n"," 23.197 | \n"," 1316.192 | \n"," 23.214033 | \n","
\n"," \n","
\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}