Session object.
get_session
The main entry point for loading F1 session data.
year: Season year (2018-current)gp: Grand Prix name or round number (e.g., “Monaco Grand Prix” or 6)session: Session name or number (e.g., “Qualifying”, “Race”, or 5)enable_cache: Enable/disable caching. IfNone, uses global configlib: DataFrame library choice (“pandas” or “polars”). IfNone, uses global config
Sessionobject ready to load data
DataNotFoundError: If the year, GP, or session doesn’t existNetworkError: If all CDN sources fail
Session
TheSession object is the central hub for all data related to a specific F1 weekend session.
Constructor
Use
get_session() instead of constructing Session directly. The function handles name normalization and validation.Properties
The season year (e.g., 2025).
URL-encoded Grand Prix name (e.g., “Monaco_Grand_Prix”).
URL-encoded session name (e.g., “Qualifying”, “Race”).
The DataFrame lib being used for this session.
Whether caching is enabled for this session.
List of driver numbers as strings in the session (e.g., [“1”, “33”, “44”]).
Loaded lazily on first access.
This returns driver NUMBERS, not driver codes. For driver codes (e.g., “VER”, “HAM”), use
drivers_df["Driver"].Alias for
drivers property. Returns driver numbers as strings.DataFrame with driver information including:
Driver: 3-letter codeTeam: Team nameDriverNumber: Car numberFirstName: Driver’s first nameLastName: Driver’s last nameTeamColor: Hex color codeHeadshotUrl: URL to driver photo
All laps for all drivers. Includes weather data automatically merged.
Loaded lazily on first access. Use
laps_async() for faster parallel loading.Weather data recorded during the session with columns:
Time: TimestampAirTemp: Air temperature (°C)TrackTemp: Track temperature (°C)Humidity: Relative humidity (%)Pressure: Atmospheric pressure (mbar)WindSpeed: Wind speed (km/h)WindDirection: Wind direction (degrees)Rainfall: Rainfall indicator
Alias for
weather property.Official messages from Race Control with columns:
Time: Message timestampCategory: Message category (e.g., “Flag”, “SafetyCar”)Message: Message textStatus: Track status codeFlag: Flag typeScope: Message scopeSector: Affected sectorRacingNumber: Affected driver number
Final classification/results for the session. Contains:
Position: Final positionDriver: Driver codeTeam: Team namePoints: Championship points earnedStatus: Finish statusTime: Total time or gap
Car telemetry data aggregated across all laps with columns:
Time: TimestampSpeed: Speed (km/h)RPM: Engine RPMnGear: Gear numberThrottle: Throttle position (%)Brake: Brake statusDRS: DRS status
Position data for all cars with columns:
Time: TimestampX,Y,Z: 3D coordinates (meters)Status: Car statusDriver: Driver code
Session metadata including start time, circuit info, and session status.
Human-readable session name (e.g., “Monaco Grand Prix - Qualifying”).
Session date and time.
Event information including circuit details and schedule.
Official session start time.
Reference time (t=0) for the session.
Session status changes throughout the session.
Track status changes (flags, safety car, etc.) with timestamps.
Total number of laps completed in the session.
This property is not yet implemented and currently returns
None.Methods
load()
laps: Load lap timing datatelemetry: Prefetch telemetry for all laps (expensive)weather: Load weather datamessages: Load race control messages
- Self (for method chaining)
laps_async()
- DataFrame with all laps
get_driver()
Driver object for the specified driver.
Parameters:
driver: 3-letter driver code (e.g., “VER”) or driver number (e.g., 33)
Driverobject
DriverNotFoundError: If the driver doesn’t exist in this session
get_fastest_laps()
by_driver: IfTrue, returns fastest lap per driver. IfFalse, returns single overall fastest lapdrivers: Optional list of driver codes to filter. IfNone, includes all drivers
- DataFrame with fastest lap(s)
get_fastest_laps_async()
get_fastest_laps() for parallel data fetching.
get_fastest_lap_tel()
ultra_cold: Enable ultra-low latency mode. IfNone, uses global config
- DataFrame with telemetry data
get_fastest_lap_tel_async()
get_fastest_lap_tel().
get_fastest_laps_tels()
by_driver: IfTrue, gets fastest lap per driver. IfFalse, gets overall fastestdrivers: Optional list of driver codes to filterultra_cold: Enable ultra-low latency mode
- Dictionary mapping driver codes to telemetry DataFrames
get_fastest_laps_tels_async()
get_fastest_laps_tels().
fetch_driver_laps_parallel()
drivers: List of driver codes
- Dictionary mapping driver codes to lap DataFrames
fetch_all_laps_telemetry()
drivers: Optional list of driver codes. IfNone, fetches for all driversultra_cold: Enable ultra-low latency mode
- Dictionary mapping (driver, lap_number) tuples to telemetry DataFrames
fetch_all_laps_telemetry_async()
fetch_all_laps_telemetry().
get_circuit_info()
CircuitInfoobject
Driver
Represents a specific driver’s performance within a session. Provides convenient access to driver-specific lap data and telemetry.Constructor
Use
session.get_driver() instead of constructing Driver directly.Properties
The 3-letter driver code (e.g., “VER”, “HAM”, “LEC”).
The car number (e.g., “33”, “44”, “16”).
Team name (e.g., “Red Bull Racing”, “Mercedes”, “Ferrari”).
All laps completed by this driver. Loaded lazily on first access.
Contains all lap timing data including sector times, compounds, stint info, etc.
Reference to the parent session object.
Methods
get_lap()
lap_number: The lap number to retrieve (1-indexed)
Lapobject for the specified lap
LapNotFoundError: If the lap doesn’t exist for this driver
get_fastest_lap()
- Single-row DataFrame with the fastest lap data
get_fastest_lap_tel()
ultra_cold: Enable ultra-low latency mode. IfNone, uses global config
- DataFrame with telemetry data (Time, Speed, RPM, Throttle, etc.)
Lap
Represents a single lap, providing access to high-frequency telemetry data. This is a lightweight wrapper around lap timing data with lazy telemetry loading.Constructor
Use
driver.get_lap() instead of constructing Lap directly.Properties
The lap number (1-indexed).
The 3-letter driver code.
The lap time in seconds. Access using Series methods:
High-frequency telemetry data for this lap. Loaded lazily on first access.
Contains Time, Speed, RPM, Throttle, Brake, nGear, DRS, and position data.
Reference to the parent session object.
Methods
get_telemetry()
telemetry property.
Returns:
- DataFrame with telemetry samples
get_car_data()
- DataFrame with car telemetry channels
get_pos_data()
- DataFrame with position data
get_weather_data()
- DataFrame with weather information
Complete Examples
Basic session usage
Working with Drivers
Working with Telemetry
Available Telemetry Columns:
Time: Timestamp (timedelta)Speed: Speed in km/hRPM: Engine RPMThrottle: Throttle position (0-100%)Brake: Brake status (boolean or 0-100%)nGear: Gear numberDRS: DRS statusX,Y,Z: 3D position coordinates (meters)Distance: Distance along track (meters)
Parallel data loading
Ultra-cold start mode
Ultra-cold mode bypasses cache validation and skips loading unnecessary data for faster cold starts.
Use when you need minimal latency and don’t need all session data. The trade-off is that some
data validation is skipped.
Error Handling
Performance Comparison
Troubleshooting
Common Issues
Issue:DriverNotFoundError when using driver codes
LapNotFoundError when accessing laps