text_html_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

medals = pd.read_csv('../input/.csv')

counted = medals.pivot_table(index='NOC', values='Athlete', columns='Medal', aggfunc='count')
counted['totals'] = counted.sum(axis='columns')
counted = counted.sort_values('totals', ascending=False)

counted = medals.pivot_table(index='NOC', values='Athlete', columns='Medal', aggfunc='count', margins=True, margins_name='Totals_all')
counted = counted.sort_values('Totals_all', ascending=False)

medals_by_gender = medals.groupby(['Event_gender', 'Gender']).count()
medals_by_gender

boolean_filter = (medals.Event_gender == 'W') & (medals.Gender == 'Men')
medals[boolean_filter]