FastF1
FastF1 is a Python package (version 3.8.2) designed for accessing and analyzing Formula 1 results, schedules, timing data, and telemetry. It provides access to F1 timing data, telemetry, and session results, along with full support for the Ergast-compatible jolpica-f1 API for historical data. All data is provided in extended Pandas DataFrames, facilitating analysis and visualization with Matplotlib integration. It features intelligent caching to optimize performance and minimize API requests.
Warnings
- gotcha Always enable caching. FastF1 heavily relies on caching to store downloaded data locally. Without it, you will experience significantly slower data loading times due to repeated API requests, and you risk hitting API rate limits.
- breaking FastF1 requires Python 3.10 or higher. Older Python versions (e.g., 3.8 or 3.9) are not supported and may lead to installation or runtime errors.
- gotcha Data availability post-race can vary. While results and lap timing might appear sooner, full telemetry data often takes 30-120 minutes after the checkered flag to become available. Automated data ingestion pipelines should account for this delay or potential partial data.
- deprecated FastF1 has transitioned its historical data access from the Ergast API to the jolpica-f1 API. While FastF1 handles this internally, users relying on older `f1dataR` integrations or directly interacting with Ergast might face issues as Ergast becomes defunct.
- gotcha Data fields may change or be unavailable with new F1 regulations. Specifically, for the 2026 regulations, new data fields related to power unit and ERS deployment might not be exposed, and existing ERS charge/deploy data may not be available through the official feeds.
Install
-
pip install fastf1
Imports
- fastf1
import fastf1
Quickstart
import fastf1
import os
# Enable caching to a local directory (e.g., 'cache')
cache_dir = os.path.join(os.getcwd(), 'fastf1_cache')
os.makedirs(cache_dir, exist_ok=True)
fastf1.Cache.enable_cache(cache_dir)
# Load a race session (e.g., 2023 Austrian Grand Prix, Race session)
session = fastf1.get_session(2023, 'Austria', 'R')
session.load(telemetry=False, weather=False)
# Print basic session information and first few laps
print(f"Loaded session: {session.event.EventName} - {session.name}")
print(f"Number of laps: {len(session.laps)}")
print("First 5 laps:\n", session.laps.head())