Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 2022 Race 1 (Bahrain) Race session crashes on session.load() #606

Open
pbulsink opened this issue Jul 3, 2024 · 2 comments
Open
Labels
external The problem is not caused by FastF1

Comments

@pbulsink
Copy link

pbulsink commented Jul 3, 2024

Describe the issue:

Discovered via f1dataR R package - our randomly selected race that is used for unit testing crashes when loaded (including with new caches). We get a failure when loading 2022 Bahrain Race (here).

Reproduce the code example:

>>> import fastf1
>>> fastf1.set_log_level('WARNING')
>>> fastf1.Cache.enable_cache('~/Documents/f1dataR/cache')
>>> session=fastf1.get_session(2022, "Bahrain", "R")
>>> session.load()

Error message:

KeyError: 'DriverNumber'
Cell In[6], line 1
----> 1 session.load()
Hide Traceback
File ~/.virtualenvs/f1dataRp311/lib/python3.11/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 ~/.virtualenvs/f1dataRp311/lib/python3.11/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 ~/.virtualenvs/f1dataRp311/lib/python3.11/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'])
@Casper-Guo
Copy link
Contributor

Same as reported in #603

@theOehrly
Copy link
Owner

Yes, I was hoping that this problem would go away faster. Nothing that we can do right now, sadly.

@theOehrly theOehrly added the external The problem is not caused by FastF1 label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external The problem is not caused by FastF1
Projects
None yet
Development

No branches or pull requests

3 participants