Fast-F1: Seeing FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas on session load

Describe the issue:

Seeing FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas on session load. Happens for atleast these sessions:

year gp session
2022 6 3
2022 5 1
2022 10 1

Reproduce the code example:

import fastf1

# Parameters
year = 2022
grand_prix = 10
session = 1

# Load session data
session = fastf1.get_session(year, grand_prix, session)
session.load()

Error message:

req         WARNING 	DEFAULT CACHE ENABLED! (24.0 KB) /home/datalore/.cache/fastf1
core           INFO 	Loading data for British Grand Prix - Practice 1 [v3.4.4]
req            INFO 	No cached data found for session_info. Loading data...
_api           INFO 	Fetching session info data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for driver_info. Loading data...
_api           INFO 	Fetching driver list...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for session_status_data. Loading data...
_api           INFO 	Fetching session status data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for track_status_data. Loading data...
_api           INFO 	Fetching track status data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for _extended_timing_data. Loading data...
_api           INFO 	Fetching timing data...
_api           INFO 	Parsing timing data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for timing_app_data. Loading data...
_api           INFO 	Fetching timing app data...
req            INFO 	Data has been written to cache!
core           INFO 	Processing timing data...
/opt/python/envs/customPyEnv311/lib/python3.11/site-packages/fastf1/core.py:1579: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '<TimedeltaArray>
['0 days 00:22:12.333000']
Length: 1, dtype: timedelta64[ns]' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
  result.loc[mask, 'LapStartTime'] = result.loc[mask, 'PitOutTime']
/opt/python/envs/customPyEnv311/lib/python3.11/site-packages/fastf1/core.py:1579: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '<TimedeltaArray>
['0 days 00:23:38.025000']
Length: 1, dtype: timedelta64[ns]' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
  result.loc[mask, 'LapStartTime'] = result.loc[mask, 'PitOutTime']
/opt/python/envs/customPyEnv311/lib/python3.11/site-packages/fastf1/core.py:1579: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '<TimedeltaArray>
['0 days 00:21:12.607000']
Length: 1, dtype: timedelta64[ns]' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
  result.loc[mask, 'LapStartTime'] = result.loc[mask, 'PitOutTime']
/opt/python/envs/customPyEnv311/lib/python3.11/site-packages/fastf1/core.py:1579: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '<TimedeltaArray>
['0 days 00:30:23.588000']
Length: 1, dtype: timedelta64[ns]' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
  result.loc[mask, 'LapStartTime'] = result.loc[mask, 'PitOutTime']
req            INFO 	No cached data found for car_data. Loading data...
_api           INFO 	Fetching car data...
_api           INFO 	Parsing car data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for position_data. Loading data...
_api           INFO 	Fetching position data...
_api           INFO 	Parsing position data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for weather_data. Loading data...
_api           INFO 	Fetching weather data...
req            INFO 	Data has been written to cache!
req            INFO 	No cached data found for race_control_messages. Loading data...
_api           INFO 	Fetching race control messages...
req            INFO 	Data has been written to cache!
core           INFO 	Finished loading data for 20 drivers: ['1', '10', '11', '14', '16', '18', '20', '22', '23', '24', '3', '31', '4', '44', '47', '5', '55', '6', '63', '77']

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (11 by maintainers)

Commits related to this issue

Most upvoted comments

this change doesnt seem to be released in v3.4.5. i’m still seeing the future warnings.

Yes, hadn’t backported it as I wasn’t planning another patch release. But v3.5.0 is now out, including this and some other changes.

Thanks for the report. Like we said in #685, we didn’t do a full sweep of the code base so issues like this will creep up again sometimes. I expect the fix to be similar. PR incoming

Confirmed no more warnings for the sessions that you mentioned. These changes should be included in the next patch release

Will test for those cases before we merge #727

@Casper-Guo thank you for figuring this out and @borolepratik thanks for reporting! I just merged #676 to fix this.