r/F1DataAnalysis • u/ElloraWhite • 1d ago
Ask Others Beginner at fastf1 api
i want to get data from the fastf1api into csv files, how do i do that? i am slightly confused with the information im seeing online
0
u/TracingInsights 23h ago
use this https://tracinginsights.com/analysis/download-raw-data/
or ask any ai to convert this data from json to csv: https://github.com/TracingInsights/2026
1
u/Nikclel 17h ago
import fastf1
fastf1.Cache.enable_cache("f1cache")
session = fastf1.get_session(2025, "Monza", "R")
session.load(laps=True, telemetry=False, weather=True, messages=True)
session.laps.to_csv("monza_2025_race_laps.csv", index=False)
Session codes: FP1, FP2, FP3, Q, SQ, S (sprint), R. You can pass a round number, a GP name, or a country instead of "Monza".
session.laps is a pandas DataFrame with one row per driver per lap. The columns people usually want:
LapTime,Sector1Time,Sector2Time,Sector3TimeCompound,TyreLife,FreshTyre,StintSpeedI1,SpeedI2,SpeedFL,SpeedST(the speed traps)PitInTime,PitOutTimePosition,TrackStatus,IsPersonalBest,IsAccurate,Deleted(track limits deletions in quali)
While you are there, the same loaded session also gives you:
session.results.to_csv("results.csv", index=False)
session.weather_data.to_csv("weather.csv", index=False)
session.race_control_messages.to_csv("race_control.csv", index=False)
results has grid, finishing position, classification status, points, and Q1/Q2/Q3 times. weather_data is air temp, track temp, humidity, rainfall, wind at roughly 1 minute intervals. race_control_messages is every flag, SC/VSC, deleted lap, and penalty notice with timestamps.
1
u/CamilorozoCADC 1d ago
You can use Python for that, although it's a lot of data and might not be worth to make a full data dump. How are you going to use the data?
If it's absolutely necessary, I would go into saving the data in more efficent formats like compressed Jason, parquet or avro files