Created
January 30, 2020 11:39
-
-
Save prateekjoshi565/5c7f632f87e8a4e8abc0e75b68b91505 to your computer and use it in GitHub Desktop.
This file contains 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
# 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