Created
October 17, 2018 17:57
-
-
Save nescobar/410f6e8efd8f6f49f249e885e3bf797b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# List of Grand Slams | |
tourneys = ['Australian Open','Roland Garros','Wimbledon','US Open'] | |
# Create dataframe with data of finals where winner_rank values are not null | |
tennis_df_1 = tennis_df[~np.isnan(tennis_df['winner_rank']) & (tennis_df['round']=='F')].copy() | |
plt.figure(figsize=(20,4)) | |
# Create one plot for each Grand Slam | |
for i in range(1,5): | |
plt.subplot(1,4,i) | |
plt.title(tourneys[i-1]) | |
plt.scatter(tennis_df_1[tennis_df_1['tourney_name']==tourneys[i-1]]['tourney_year'],tennis_df_1[tennis_df_1['tourney_name']==tourneys[i-1]]['winner_rank'], s=tennis_df_1['loser_rank']) | |
plt.gca().invert_yaxis() | |
plt.ylim(50,-5) | |
plt.xlabel('Year') | |
plt.ylabel('Winner Ranking') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment