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

Segmentation fault on pandas interop with EventSchedule #565

Closed paddymul closed 3 months ago

paddymul commented 3 months ago

Describe the issue:

I'm getting a segmentation fault when doing a simple operation on an EventSchedule dataframe. I'm not sure if it's an error in fastf1 or pandas.

I have library code that executes the following code. it works fine with a pandas dataframe

buckaroo.debug_packages()
#
pandas           : 2.0.2
numpy            : 1.24.3

Reproduce the code example:

import fastf1
import pandas as pd
pd.DataFrame(fastf1.get_event_schedule(2020))

Error message:

Fatal Python error: Segmentation fault

Current thread 0x00000001e2de2080 (most recent call first):
  File "/Users/paddy/anaconda3/envs/df_cereal_env3/lib/python3.8/site-packages/pandas/io/json/_json.py", line 244 in write
  File "/Users/paddy/anaconda3/envs/df_cereal_env3/lib/python3.8/site-packages/pandas/io/json/_json.py", line 181 in to_json
  File "/Users/paddy/anaconda3/envs/df_cereal_env3/lib/python3.8/site-packages/pandas/core/generic.py", line 2532 in to_json
  File "/Users/paddy/buckaroo/buckaroo/seriali
theOehrly commented 3 months ago

Hi, this looks like a bug in buckaroo. The problem is easily reproducible in environments where FastF1 is not even installed.

It seems to be caused by the presence of pandas.Timestamp values in a DataFrame. In the event schedule, this is for example the EventDate column.

I've opened https://github.com/paddymul/buckaroo/issues/267 for you.

paddymul commented 3 months ago

Thank you! FastF1 looks great, I'm going to start digging into it soon and building some demos.