https://github.com/alec-kr/F1PyStats
An open-source Python3 package that provides Formula 1 data to developers.
https://github.com/alec-kr/F1PyStats
codecov collaborate ergast-api ergast-developer-api ergast-drivers-api f1 formula1 github hacktoberfest jetbrains pandas python student-vscode
Last synced: about 2 hours ago
JSON representation
An open-source Python3 package that provides Formula 1 data to developers.
- Host: GitHub
- URL: https://github.com/alec-kr/F1PyStats
- Owner: alec-kr
- License: gpl-3.0
- Created: 2022-09-16T18:29:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2026-05-04T23:27:37.000Z (about 2 months ago)
- Last Synced: 2026-05-05T01:26:08.838Z (about 2 months ago)
- Topics: codecov, collaborate, ergast-api, ergast-developer-api, ergast-drivers-api, f1, formula1, github, hacktoberfest, jetbrains, pandas, python, student-vscode
- Language: Python
- Homepage:
- Size: 540 KB
- Stars: 60
- Watchers: 4
- Forks: 20
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-f1 - F1PyStats - Python package for standings, race results, and historical summaries. (Formula 1 / APIs and Libraries)
README
# F1PyStats
## ⚠️ Project Status
F1PyStats is currently not maintained due to dependency on the Ergast API.
Future updates may include migration to a new data source if available.
##

[](https://github.com/alec-kr/F1PyStats)
[](https://github.com/alec-kr/F1PyStats/network/members)
[](https://codecov.io/gh/alec-kr/F1PyStats)
[](https://github.com/alec-kr/F1PyStats/blob/main/LICENSE)
[](https://github.com/alec-kr/F1PyStats/issues)
[](https://github.com/alec-kr/F1PyStats/pulls)
[](https://github.com/alec-kr/F1PyStats/graphs/contributors)
F1PyStats is an open-source Python3 package that provides Formula 1 data/statistics to developers. This package obtains Formula 1 data via the [Ergast Developer API](http://ergast.com/mrd/), and returns results in a pandas DataFrame format.
# Prerequisites
## Python3
Before installing the package, you should ensure your Python version is at least [v3.11](https://www.python.org/downloads/release/python-3110/). If your version does not meet the requirements, please [download](https://www.python.org/downloads/) a newer version to ensure the package works as expected.
## Poetry
The package uses [Poetry](https://python-poetry.org/) ([v1.2](https://github.com/python-poetry/poetry/releases/tag/1.2.0) or higher) as the primary dependency management tool. To install this tool, kindly follow their [official installation instructions](https://python-poetry.org/docs/).
# Installation
```
// Clone the repo
$ git clone https://github.com/alec-kr/F1PyStats.git
// Install dependecies using poetry
$ cd ../F1PyStats
$ poetry install --only main
// Build the package if you would to use it in other projects (https://python-poetry.org/docs/cli/#build)
poetry build
// Install built package (https://python-poetry.org/docs/cli/#add)
poetry add ../F1Pystats/dist/f1pystats-0.1.1.whl
```
# Usage
```
# Import the package
import F1PyStats as fp
```
The package currently contains thirteen functions
| Function | Description | Returned Datatype |
|----------------------------- |--------------------------------------------------------------------- |------------------- |
| fp.driver_standings(year) | Returns the driver standings for a particular year | Pandas DataFrame |
| fp.constructor_standings(year) | Returns the constructor standings for a specified year | Pandas DataFrame |
| fp.race_winners(year) | Returns the race winners for a specified year | Pandas DataFrame |
| fp.race_table(year) | Returns the race schedule for a specific year | Pandas DataFrame |
| fp.lap_times(year, race_round, lap_number) | Returns the lap times for a specific lap in a particular race | Pandas DataFrame |
| fp.pit_stops(year, round, stop_number, fastest) | Returns the pit stop info for a specific race/pit stop | Pandas DataFrame |
| fp.finishing_status(year,race_round) | Returns the finishing status of races in a year (or a particular race if specified) | Pandas DataFrame |
|fp.get_drivers(year, race_round) | Returns information on drivers in a given year (or a particular race if specified) | Pandas DataFrame |
|fp.get_constructors(year) | Returns information on constructors in a given year | Pandas DataFrame |
|fp.sprint_results(year,race_round) | Returns the sprint qualifying results for a specific race | Pandas DataFrame|
|fp.qualifying_results(year, race_round) | Returns the qualifying results of a particular race | Pandas DataFrame |
|fp.get_circuits(year) | Returns the circuit details of a specific race for a specific year| Pandas DataFrame |
|fp.fastest_laps(year, race_round) | Returns the fastest lap for a particular race | Pandas DataFrame |
# Generate API docs
The following command will generate API documentation under `docs/_build`.
```
$ poetry run nox -s docs
```
# Contributions
Please ensure you follow our [contributing guidelines](https://github.com/alec-kr/F1PyStats/blob/main/CONTRIBUTING.md) when contributing in any way to this repository.
## Feature Requests
Perhaps you have a great idea for a feature, but you're not sure how to implement it.
No worries! You can [create a feature request](https://github.com/alec-kr/F1PyStats/issues/new/choose), and someone will get in touch with you :grin:
## Creating PRs
Know how to code and you'd like to add a feature? Feel free to [create a PR](https://github.com/alec-kr/F1PyStats/compare) :rocket:
## Bug Reports
Spot an issue or bug? Please let us know by [creating a bug report](https://github.com/alec-kr/F1PyStats/issues/new/choose) :bug:
## Our Valuable Contributors✨
Happy Coding 👨💻