You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There aren't any current plans to return results as pandas dataframes. The idea is to keep the data as simple as possible for end-users to work with, and adding a requirement for an additional data analysis library.
That being said, I haven't worked pandas before and therefore don't know it's benefits. Perhaps a working example could provide more context for reasoning?
pandas is a widely used package for working with tabular datasets. I haven't really used ergast data in a Python context to date, but I have used it with R (Wrangling F1 data with R) and R dataframes (which are very similar to pandas dataframes).
Tabular data is trivial to work with, but wrangling the ergast data into a tabular format can be a reall faff for users, although tools are getting better that support flattening hierachical datasets, such as the pandas.normalize() function. Here's an example of how to use it using the ergast support provided in the fastf1 package:
fromfastf1importergastimportpandasaspd# The request returns hierarchical JSON dataerd_race=ergast.fetch_results(2022, 2, "Race")
# Flatten JSON structure to generate a 2d table / pandas dataframepd.json_normalize(erd_race)
Other calls supported by fastf1:
pd.json_normalize(ergast.fetch_season(2022)): season info
pd.json_normalize(ergast.fetch_weekend(2022, 2)).T: metadata about a particular race weekend
At the moment, it doesn't look like there is a function to pull back the laps data.
Hi
V. interesting looking project; will be interesting to see how it can complement
fast-f1
.I was wondering if there is any plan to return results tables as
pandas
dataframes?The text was updated successfully, but these errors were encountered: