theOehrly / Fast-F1

FastF1 is a python package for accessing and analyzing Formula 1 results, schedules, timing data and telemetry
https://docs.fastf1.dev
MIT License
2.29k stars 239 forks source link

[BUG] Loading data from the 2021 season does not work anymore #607

Open lalutir opened 2 days ago

lalutir commented 2 days ago

Describe the issue:

As previously reported by other people, the data from the 2022 season cannot be loaded anymore. However since last night, the same error started occurring for me for the 2021 season as well. The error is a KeyError on 'DriverNumber'

Reproduce the code example:

fp1 = ff1.get_session(2021, 1, 'FP1')
fp1.load()
fp1 = fp1.laps

Error message:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[15], line 2
      1 fp1 = ff1.get_session(2021, 1, 'FP1')
----> 2 fp1.load()
      3 fp1 = fp1.laps

File c:\Users\***\AppData\Local\Programs\Python\Python311\Lib\site-packages\fastf1\core.py:1424, in Session.load(self, laps, telemetry, weather, messages, livedata)
   1419 _logger.info(f"Loading data for "
   1420              f"{self.event['EventName']} - {self.name}"
   1421              f" [v{fastf1.__version__}]")
   1423 self._load_session_info(livedata=livedata)
-> 1424 self._load_drivers_results(livedata=livedata)
   1426 if self.f1_api_support:
   1427     if laps:

File c:\Users\***\AppData\Local\Programs\Python\Python311\Lib\site-packages\fastf1\core.py:2189, in Session._load_drivers_results(self, livedata)
   2185 # try loading from both sources if they are supported
   2186 # data is joined afterwards depending on availability
   2187 if self.f1_api_support:
   2188     # load driver info from f1 api
-> 2189     driver_info_f1 = self._drivers_from_f1_api(livedata=livedata)
   2190 if not self.event.is_testing():
   2191     # load driver info from ergast
   2192     driver_info_ergast = self._drivers_results_from_ergast(
   2193         load_drivers=True, load_results=True
   2194     )

File c:\Users\***\AppData\Local\Programs\Python\Python311\Lib\site-packages\fastf1\core.py:2273, in Session._drivers_from_f1_api(self, livedata)
   2270         for first, last in zip(driver_info['FirstName'],
   2271                                driver_info['LastName']):
   2272             driver_info['FullName'].append(f"{first} {last}")
-> 2273 return pd.DataFrame(driver_info, index=driver_info['DriverNumber'])

KeyError: 'DriverNumber'
theOehrly commented 2 days ago

Thanks for noticing. As far as I'm aware, F1 is still working on their cloud provider/server migration. Let's wait and see what happens there.

ChemiF1 commented 1 day ago

Could be possible to create some kind of backup server? Just to get the data if the normal server fails

Casper-Guo commented 1 day ago

That will require access to the database that powers the F1 API backend. Even if we can reconstruct it, hosting that much data (all the telemetry for every session since 2018) can get expensive.

theOehrly commented 1 day ago

I'd really prefer not needing to host this. There's a bunch of reasons why. Cost and creating yet another thing that needs maintenance are just two examples.