Skip to main content

Wrapper library for F1 data and telemetry API with additional data processing capabilities.

Project description

A python package for accessing F1 historical timing data and telemetry.

IMPORTANT NOTE: Status of the project (Update 3: 13th March 2021)

FastF1 v2.1 is now available for installation through pip. The old way of installing via pip + git directly from the master branch is no longer recommended.

It is no longer possible to download telemetry and car position data after a session!

See this Twitter post for some information.

This means:

  • It is still possible to load timing data, tire data, track status data and session status data.

  • It is not possible to load car telemetry data (includes position data). You need to record live timing data during a session for this!

Live timing data

A livetiming client has been added for the v2.1 release. The client can be used to save the live timing telemetry data stream that is available during sessions. This can potentially be used to work around the problem of missing data on the server.

The live timing client does not and will never parse data in real time! Data can only be parsed and used after a session has completed. This is a limitation of FastF1’s api parser. For various reasons there is no intention of changing this.

Consider all live timing related functionality as beta-grade at best.

For usage see the documentation.

Changes

If you have used previous versions of FastF1, please read the changelog in the documentation.

V2.1 introduces some new features and some breaking changes. The documentation is improved in general. Also, there is a new section discussing how to get the most accurate results from the data that is available. It may be worth reading if you want to make more complicated analyses and visualizations.

Other

Please report bugs if (when) you find them. Feel free to report complaints about unclear documentation too. The available documentation is updated for this version.

Interested in contributing? See below…

Installation

It is recommended to install FastF1 using pip:

pip install fastf1

Note that Python 3.8 is required.

Alternatively a wheel or a source distribution can be downloaded from the Github releases page.

Usage

Full documentation can be found here.

Creating a simple analysis is not very difficult, especially if you are already familiar with pandas and numpy.

Suppose that we want to analyse the race pace of Leclerc compared to Hamilton from the Bahrain GP (weekend number 2) of 2019.

import fastf1 as ff1
from fastf1 import plotting
from matplotlib import pyplot as plt

plotting.setup_mpl()

ff1.Cache.enable_cache('path/to/folder/for/cache')  # optional but recommended

race = ff1.get_session(2020, 'Turkish Grand Prix', 'R')
laps = race.load_laps()

lec = laps.pick_driver('LEC')
ham = laps.pick_driver('HAM')

Once the session is loaded, and drivers are selected, you can plot the information.

fastf1.plotting provides some special axis formatting and data type conversion. This is required for generating a correct plot.

It is not necessary to enable the usage of a cache but it is recommended. Simply provide the path to some empty folder on your system.

fig, ax = plt.subplots()
ax.plot(lec['LapNumber'], lec['LapTime'], color='red')
ax.plot(ham['LapNumber'], ham['LapTime'], color='cyan')
ax.set_title("LEC vs HAM")
ax.set_xlabel("Lap Number")
ax.set_ylabel("Lap Time")
plt.show()
docs/_static/readme.svg

Compatibility

Timing data is available for the 2018, 2019 and 2020 season. Very basic weekend information is available for older seasons (limited to Ergast web api). Live timing and telemetry is only available starting from 2018.

Roadmap

This is a rather loose roadmap with no fixed timeline whatsoever.

  • Improvements to the current plotting functionality

  • Some default plots to easily allow creating nice visualizations and interesting comparisons

  • General improvements and smaller additions to the current core functionality

  • Support for F1’s own data api to get information about events, sessions, drivers and venues

Contributing

Contributions are welcome of course. If you are interested in contributing, open an issue for the proposed feature or issue you would like to work on. This way we can coordinate so that no unnecessary work is done.

Working directly on the core and api code will require some time to understand. Creating nice default plots on the other hand does not required as deep of an understanding of the code and is therefore easier to accomplish. Pick whatever you like to do.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastf1-2.1.1.tar.gz (56.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastf1-2.1.1-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file fastf1-2.1.1.tar.gz.

File metadata

  • Download URL: fastf1-2.1.1.tar.gz
  • Upload date:
  • Size: 56.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for fastf1-2.1.1.tar.gz
Algorithm Hash digest
SHA256 f3bcb054c43a88268503bd3ae7e18db7f2ba13104b57c69ba5c5ea7261e7a8ce
MD5 1b2d1a493f259363c0a996008604b435
BLAKE2b-256 2a1efe16dfec887dfaf55239a10d11e7cb82622a82dea326fb993b8a645cfbac

See more details on using hashes here.

File details

Details for the file fastf1-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: fastf1-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for fastf1-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6fe2cf1c9e7620197eb5ab29775432a448ab8754e07e4661bdba5efa352ffa1f
MD5 d7fa1cf695115dfc874ae97d0a8cbad2
BLAKE2b-256 c5764386f77aa88c67b6a534888ab699a07f316027a5d186c005e411dd073497

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page