Example Lap Analysis Using FormulaPy's Ergast API¶

Ergast implements a REST API for accessing their database for F1 and Formula E. They also provide a mysql database file, but this requires that you setup mysql. This library will support the database access, but for now supports the REST API, which makes it easier for anyone to get up and running with the library.

FormulaPy generally implements python classes to represent the different concepts implemented by Ergast and/or formula racing. By using classes for the api, instead of just raw tables retrieved by simple functions or queries, convenience methods can be added to produce charts, and/or dynamically add additional data that isn't included in the Ergast data set. Additionally, what could be a sequence of steps/queries, can be or will be available through simple dot ('.') notation, which supports more exploratory browsing. For example, f1.seasons.s2015.<tab> , would dynamically query Ergast for the list of races for 2015, and most IDEs/REPLs will present the user with what is available. Then, you can drill down to more elements through dot notation to get to more specific information.

Once you drill down to what you want, you can access the table of data as a Pandas DataFrame. Or, you can utilize the convenience methods for directly producing charts, using the subset of data. This notebook demonstrates some of these concepts.

FormulaPy is not a python package, but will be after it matures a bit more. For now, the easiest way to get started is to install Anaconda, then clone the FormulaPy github repository. There may be additional dependencies (beyond Anaconda's base install) required to install via: pip install LIBRARY_NAME , such as:

lazy

atom

seaborn

As the API becomes more stable, I'd love to have people add more reuseable charts. Getting consistent acess and visualizing data was the first step. Eventually I'll be adding some statistical modeling for predicting outcomes of races, so inputs on that side are also welcome.

Contact me @rothnic or through the Github FormulaPy project.