Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Created September 10, 2018 23:18
team_medal_count = df.groupby(['Team','Medal']).Medal.agg('count')
# order them by quantity
team_medal_count = team_medal_count.reset_index(name='count').sort_values(['count'], ascending=False)
#team_medal_count.head(40) to show the first rows
def get_country_stats(country):
return team_medal_count[team_medal_count.Team==country]
# get_country_stats('some_country') to get that country's medals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment