diff --git a/fastf1/_api.py b/fastf1/_api.py index b6d91212..02e4f532 100644 --- a/fastf1/_api.py +++ b/fastf1/_api.py @@ -860,11 +860,7 @@ def timing_app_data(path, response=None, livedata=None): data['Driver'][-1] = driver_number data['Stint'][-1] = stint_number - df = pd.DataFrame(data) - # pandas doesn't correctly infer bool dtype columns, set type explicitly - df[['New', 'TyresNotChanged']] \ - = df[['New', 'TyresNotChanged']].astype(bool) - return df + return pd.DataFrame(data) @Cache.api_request_wrapper diff --git a/fastf1/core.py b/fastf1/core.py index 508699fe..dfd4fa57 100644 --- a/fastf1/core.py +++ b/fastf1/core.py @@ -1463,7 +1463,6 @@ def _load_laps_data(self, livedata=None): data.drop(columns=['NumberOfPitStops'], inplace=True) useful = app_data[['Driver', 'Time', 'Compound', 'StartLaps', 'New', 'Stint']] - useful = useful[~useful['Compound'].isnull()] drivers = self.drivers if not drivers: diff --git a/fastf1/req.py b/fastf1/req.py index 46cc669b..8e4094ed 100644 --- a/fastf1/req.py +++ b/fastf1/req.py @@ -218,7 +218,7 @@ class Cache(metaclass=_MetaCache): """ _CACHE_DIR = None # version of the api parser code (unrelated to release version number) - _API_CORE_VERSION = 13 + _API_CORE_VERSION = 14 _IGNORE_VERSION = False _FORCE_RENEW = False diff --git a/fastf1/tests/test_api.py b/fastf1/tests/test_api.py index 5fa75a29..743b365f 100644 --- a/fastf1/tests/test_api.py +++ b/fastf1/tests/test_api.py @@ -82,7 +82,7 @@ def test_timing_app_data(): assert len(data.columns) == 13 assert (data.dtypes == [ 'float64', 'object', 'timedelta64[ns]', 'int64', 'float64', - 'object', 'bool', 'bool', 'timedelta64[ns]', 'float64', + 'object', 'object', 'object', 'timedelta64[ns]', 'float64', 'object', 'float64', 'object']).all() diff --git a/fastf1/tests/test_core.py b/fastf1/tests/test_core.py index 33f0452e..cdf11447 100644 --- a/fastf1/tests/test_core.py +++ b/fastf1/tests/test_core.py @@ -141,3 +141,30 @@ def test_rcm_parsing_deleted_laps(): assert not fastest['Deleted'] assert fastest['DeletedReason'] == "" assert fastest['IsPersonalBest'] + + +def test_tyre_data_parsing(): + session = fastf1.get_session(2024, 'Silverstone', 'FP1') + session.load(telemetry=False) + + ver = session.laps.pick_drivers('VER') + + ref = pd.DataFrame( + [[1.0, 'HARD', True, 1.0], [1.0, 'HARD', True, 2.0], + [1.0, 'HARD', True, 3.0], [1.0, 'HARD', True, 4.0], + [1.0, 'HARD', True, 5.0], [2.0, 'HARD', False, 6.0], + [2.0, 'HARD', False, 7.0], [2.0, 'HARD', False, 8.0], + [3.0, 'MEDIUM', True, 1.0], [3.0, 'MEDIUM', True, 2.0], + [3.0, 'MEDIUM', True, 3.0], [3.0, 'MEDIUM', True, 4.0], + [3.0, 'MEDIUM', True, 5.0], [4.0, 'HARD', False, 9.0], + [4.0, 'HARD', False, 10.0], [4.0, 'HARD', False, 11.0], + [4.0, 'HARD', False, 12.0], [4.0, 'HARD', False, 13.0], + [4.0, 'HARD', False, 14.0], [4.0, 'HARD', False, 15.0], + [4.0, 'HARD', False, 16.0], [4.0, 'HARD', False, 17.0], + [4.0, 'HARD', False, 18.0], [4.0, 'HARD', False, 19.0], + [4.0, 'HARD', False, 20.0]], + columns=['Stint', 'Compound', 'FreshTyre', 'TyreLife'] + ) + + compare = ver[['Stint', 'Compound', 'FreshTyre', 'TyreLife']] + assert compare.equals(ref)