Last active
August 23, 2022 20:13
-
-
Save lmeulen/d85c2384cbe63b4721fffaee246b8e69 to your computer and use it in GitHub Desktop.
ergast_places_gained
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
year = 2022 | |
rnd = 13 | |
pgl = stats.get_race_results(year) | |
pgl = pgl[pgl['round'] == rnd][['driver', 'grid', 'position']] | |
pgl['change'] = pgl['grid'] - pgl['position'] | |
def _color_red_or_green(val): | |
color = 'orangered' if val < 0 else 'springgreen' | |
return 'background-color: %s' % color | |
pgl.style.applymap(_color_red_or_green, subset=['change']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment