https://github.com/arabacibahadir/f1stats
Formula 1 driver comparison and analyzing tool.
https://github.com/arabacibahadir/f1stats
f1stats fastf1 formula1 python3 race
Last synced: 8 months ago
JSON representation
Formula 1 driver comparison and analyzing tool.
- Host: GitHub
- URL: https://github.com/arabacibahadir/f1stats
- Owner: arabacibahadir
- Created: 2021-09-29T23:10:03.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T17:22:25.000Z (almost 3 years ago)
- Last Synced: 2025-03-17T02:11:23.382Z (8 months ago)
- Topics: f1stats, fastf1, formula1, python3, race
- Language: Python
- Homepage:
- Size: 52.7 KB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# f1stats
Formula 1 driver comparison and race analyzing tool.
**[f1stats](https://github.com/arabacibahadir/f1stats)** uses [Fast-F1]( https://github.com/theOehrly/Fast-F1#fast-f1 ) core for race and driver analysis.
The [Fast-F1](https://github.com/theOehrly/Fast-F1#fast-f1 ) core is a collection of functions and data objects for accessing
and analyzing F1 timing and telemetry data.

## Setup
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install libraries.
```bash
pip install fastf1
pip install matplotlib
pip install numpy
pip install pandas
```
## Usage
[Example](https://theoehrly.github.io/Fast-F1/examples/index.html#example-plot) plots.
For example, if you want to compare _Bottas_ and _Hamilton_.
```bash
driver1 = 'BOT'
driver2 = 'HAM'
```
You can also choose all other drivers.
```bash
# 2020 season
D_LOOKUP = [[44, 'HAM', 'Mercedes'], [77, 'BOT', 'Mercedes'],
[55, 'SAI', 'Ferrari'], [16, 'LEC', 'Ferrari'],
[33, 'VER', 'Red Bull'], [11, 'PER', 'Red Bull'],
[3, 'RIC', 'McLaren'], [4, 'NOR', 'McLaren'],
[5, 'VET', 'Aston Martin'], [18, 'STR', 'Aston Martin'],
[14, 'ALO', 'Alpine'], [31, 'OCO', 'Alpine'],
[22, 'TSU', 'AlphaTauri'], [10, 'GAS', 'AlphaTauri'],
[47, 'MSC', 'Haas F1 Team'], [9, 'MAZ', 'Haas F1 Team'],
[7, 'RAI', 'Alfa Romeo'], [99, 'GIO', 'Alfa Romeo'],
[6, 'LAT', 'Williams'], [63, 'RUS', 'Williams']]
```
The Fast-F1 developer recommends using **cache**. From this [document](https://theoehrly.github.io/Fast-F1/examples/index.html#example-plot):
> It is not necessary to enable the usage of the cache, but it is **highly recommended**. Simply provide the path to some empty folder on **your** system. Using the cache will greatly speed up loading of the data.
```bash
ff1.Cache.enable_cache(r'path/to/folder/for/cache') # Replace with your cache directory
```
A fuzzy match is performed to find the most likely event for the provided name (e.g. 'Bahrain').
```bash
race = ff1.get_session(2021, 'Zandvoort', 'R') # 'FP1', 'FP2', 'FP3', 'Q', 'SQ' or 'R'
# FP1 : Free Practice 1
# FP2 : Free Practice 2
# FP3 : Free Practice 3
# Q : Qualifying
# SQ : Sprint Qualifying
# R : Race
```
## Functions
```bash
def track(): # Track layout - Fastest Lap Gear Shift Visualization
def gas(): # Car telemetry data ['RPM', 'Speed', 'Throttle', 'Brake', 'nGear', 'DRS']
def compare(): # Two drivers comparison
def qualifying(): # Fastest lap
```
## Compatibility
Data is available for the 2018 to 2023 seasons. Fast-F1 uses data from F1's live timing service.
## Screenshots




## Contributing
Pull requests are welcome. Before PR please open an issue what you would like to change.
Follow [PEP 8 Coding Style guidelines](https://www.python.org/dev/peps/pep-0008/).