Skip to content

Instantly share code, notes, and snippets.

@prateekjoshi565
Created January 30, 2020 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prateekjoshi565/5c7f632f87e8a4e8abc0e75b68b91505 to your computer and use it in GitHub Desktop.
Save prateekjoshi565/5c7f632f87e8a4e8abc0e75b68b91505 to your computer and use it in GitHub Desktop.
# empty list to store players name
p1 = []
p2 = []
# empty lists to store median of runs scored
r1 = []
r2 = []
for p in df_dc['partnership'].unique():
temp = df_dc[df_dc['partnership'] == p]
p1.append(temp.iloc[0]['player_1'])
p2.append(temp.iloc[0]['player_2'])
a = []
b = []
# extract individual scores for both the players
for index, row in temp.iterrows():
# scores of player 1
a.append(row['score_1'])
# scores of player 2
b.append(row['score_2'])
# append median of scores
r1.append(median(a))
r2.append(median(b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment