Skip to main content
FastF1 organizes Formula 1 data around the concepts of Events (race weekends) and Sessions (individual practice, qualifying, or race sessions). This page covers how to access and work with these fundamental objects.

Overview

The typical workflow for loading F1 data starts with identifying an event and session:
import fastf1

# Get a specific session
session = fastf1.get_session(2021, 'Bahrain', 'Q')
session.load()

Getting a Session

The primary entry point is get_session(), which returns a Session object based on year, event, and session identifier.

Function: get_session()

fastf1.get_session(
    year: int,
    gp: str | int,
    identifier: int | str | None = None,
    *,
    backend: Literal['fastf1', 'f1timing', 'ergast'] | None = None,
    exact_match: bool = False
) -> Session
year
int
required
Championship year (e.g., 2021, 2023)
gp
str | int
required
Event name as a string or round number as an integer. String matching uses fuzzy search by default.Examples: 'bahrain', 'Silverstone', 1 (first round)
identifier
int | str | None
Session identifier - can be:
  • Session name: 'Race', 'Qualifying', 'Practice 1'
  • Abbreviation: 'R', 'Q', 'FP1', 'FP2', 'FP3', 'S' (Sprint), 'SQ' (Sprint Qualifying)
  • Session number: 1, 2, 3, 4, 5
backend
Literal['fastf1', 'f1timing', 'ergast'] | None
Data source backend:
  • 'fastf1': FastF1’s own backend (default, 2018-present)
  • 'f1timing': F1 live timing API (2018-present)
  • 'ergast': Ergast database (1950-present, limited features)
exact_match
bool
default:"False"
If True, requires exact event name match instead of fuzzy search

Usage Examples

# Get the second free practice of the first race of 2021
session = fastf1.get_session(2021, 1, 'FP2')
get_session() returns a Session object but does not load any data yet. You must call session.load() to fetch timing, telemetry, and other session-specific data.

Getting an Event

You can also access the event object directly using get_event().

Function: get_event()

fastf1.get_event(
    year: int,
    gp: int | str,
    *,
    backend: Literal['fastf1', 'f1timing', 'ergast'] | None = None,
    exact_match: bool = False
) -> Event
Returns an Event object representing a complete race weekend.
year
int
required
Championship year
gp
int | str
required
Event name (string) or round number (integer)

Event Class

The Event class represents a single race weekend and provides methods to access individual sessions.
import fastf1

# Get the event
event = fastf1.get_event(2021, 'Bahrain')

# Access event information
print(event.EventName)          # 'Bahrain Grand Prix'
print(event.Country)            # 'Bahrain'
print(event.Location)           # 'Sakhir'
print(event.RoundNumber)        # 1
print(event.EventFormat)        # 'conventional' or 'sprint'

# Get specific sessions from the event
race = event.get_race()
quali = event.get_qualifying()
fp1 = event.get_practice(1)

Event Methods

Returns a Session object for the specified session.
session = event.get_session('Q')
session = event.get_session(5)  # Session 5 (usually Race)
Returns the race session.
race = event.get_race()
Returns the qualifying session.
quali = event.get_qualifying()
Returns the sprint session (if applicable).
sprint = event.get_sprint()
Returns the specified practice session.
fp1 = event.get_practice(1)
fp2 = event.get_practice(2)
fp3 = event.get_practice(3)
Returns True if this is a testing event.
if event.is_testing():
    print("This is a testing event")

Event Schedules

Getting the Event Schedule

fastf1.get_event_schedule(
    year: int,
    *,
    include_testing: bool = True,
    backend: Literal['fastf1', 'f1timing', 'ergast'] | None = None
) -> EventSchedule
Returns an EventSchedule object containing all events for a season.
import fastf1

# Get all events for 2023
schedule = fastf1.get_event_schedule(2023)

# Access the schedule as a DataFrame
for index, event in schedule.iterrows():
    print(f"{event.RoundNumber}: {event.EventName} - {event.Country}")

# Get a specific event from the schedule
bahrain = schedule.get_event_by_round(1)
monaco = schedule.get_event_by_name('Monaco')

EventSchedule Class

The EventSchedule class extends pandas DataFrame and provides additional methods:
Get an event by its round number.
first_race = schedule.get_event_by_round(1)
Get an event by name using fuzzy matching.
# Fuzzy matching
monza = schedule.get_event_by_name('monza')

# Exact matching
british = schedule.get_event_by_name('British Grand Prix', exact_match=True)
Returns a boolean Series indicating which events are testing events.
testing_events = schedule[schedule.is_testing()]

Available Event Data

Each event in the schedule contains:
  • RoundNumber - Round number in the championship
  • Country - Country where the event takes place
  • Location - Specific location/circuit
  • EventName - Short name of the event
  • OfficialEventName - Official full name
  • EventDate - Date of the event (usually race day)
  • EventFormat - Format type: 'conventional', 'sprint', 'sprint_shootout', 'sprint_qualifying', or 'testing'
  • Session1 through Session5 - Names of each session
  • Session1Date through Session5Date - Local timestamps for each session
  • Session1DateUtc through Session5DateUtc - UTC timestamps for each session
  • F1ApiSupport - Whether F1 API data is available

Testing Sessions

Pre-season testing sessions require special functions:
# Get a testing event
test_event = fastf1.get_testing_event(2023, test_number=1)

# Get a specific testing session
test_session = fastf1.get_testing_session(2023, test_number=1, session_number=1)
test_session.load()

Session Object

Once you have a Session object, you can access its properties:
session = fastf1.get_session(2023, 'Monaco', 'Q')

# Session information (available before loading)
print(session.name)              # 'Qualifying'
print(session.date)              # pandas.Timestamp of session date
print(session.event.EventName)   # 'Monaco Grand Prix'
print(session.f1_api_support)    # True/False
Most session data is only available after calling session.load(). See the Loading Data page for details.

Build docs developers (and LLMs) love