text_html_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

athlete_df = pd.read_csv('../input/120-years-of-olympic-history-athletes-and-results/athlete_events.csv')
region_df = pd.read_csv('../input/120-years-of-olympic-history-athletes-and-results/noc_regions.csv')

data = pd.merge(athlete_df, region_df, how='left', on='NOC')

data.rename(columns={'region': 'Region', 'notes': 'Notes'}, inplace=True)

data.isnull().sum().sort_values(ascending=False)

data.query('Team == "Egypt"')

data.query('Team == "Egypt" and Medal == "Gold"')

data[data.Age == data.Age.max()]

goldMedals = data[data.Medal == 'Gold']
goldMedals = goldMedals[np.isfinite(goldMedals['Age'])]

plt.tight_layout()

masters = goldMedals['Sport'][goldMedals['Age'] > 50]

plt.figure(figsize=(20, 10))
plt.tight_layout()
sns.countplot(masters)
plt.title('Gold Medals for Athletes Over 50')