Issue using .to_datetime on laps data frame #451
-
Hi, I'm trying to create a histogram plot of lap times from a race to see their distribution. I'm trying to use the below code to do it but keep getting the error 'object has no attribute 'to_datetime' Any ideas on what may be wrong or how I can create the histogram plot? import fastf1 import fastf1.plotting #Set up cache for race data from fastf1 laps=race.laps.pick_quicklaps().reset_index() hour_list = [t.hour for t in data] plt.hist(hour_list,bins) Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
A minimally functional implementation:
|
Beta Was this translation helpful? Give feedback.
-
@laurence9899 A note here, the LapTime is a timedelta object which is a duration (e.g. 1 hour). Therefore, it cannot be converted to a datetime object which is a specific point in time (e.g. 1st October 2023). Maybe you were aiming for this In any case, the solution by @Casper-Guo is likely what you want to use. |
Beta Was this translation helpful? Give feedback.
A minimally functional implementation: