Created
August 21, 2022 19:11
-
-
Save lmeulen/3abe0f0885ca927daef5476faeefd91d to your computer and use it in GitHub Desktop.
ergast_field_experience
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
results = stats.get_race_results() | |
current_driver_ids = results[results['year'] == 2022]['driverId'] | |
current_drivers = results[results['driverId'].isin(pd.unique(current_driver_ids))] | |
current_drivers = current_drivers[['driverId', 'driver', 'race']]. \ | |
groupby(['driverId', 'driver']).count().reset_index() | |
stats.horizontal_barplot(df=current_drivers, rowcount=30, sort_value='race', | |
sort_ascending=False, invert_yaxis=True, | |
xcolumn='driver', ycolumn='race', | |
title='Number of races by drivers in current season', | |
xlabel = 'races', ylabel='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment