/F1PyStats

An open-source Python3 package that provides Formula 1 data to developers.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

F1PyStats

icon

GitHub Repo stars GitHub forks

codecov GitHub GitHub issues GitHub pull requests GitHub 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, and returns results in a pandas DataFrame format.

Prerequisites

Python3

Before installing the package, you should ensure your Python version is at least v3.10. If your version does not meet the requirements, please download a newer version to ensure the package works as expected.

Poetry

The package uses Poetry (v1.2 or higher) as the primary dependency management tool. To install this tool, kindly follow their official installation instructions.

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

NOTE: Please ensure you follow our contributing guidelines 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, and someone will get in touch with you 😁

Creating PRs

Know how to code and you'd like to add a feature? Feel free to create a PR 🚀

Bug Reports

Spot an issue or bug? Please let us know by creating a bug report 🐛

Our Valuable Contributors✨

Happy Coding 👨‍💻