Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created February 16, 2020 18:00
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 aravindpai/c987f18ac5de125a00cbb740e565894c to your computer and use it in GitHub Desktop.
Save aravindpai/c987f18ac5de125a00cbb740e565894c to your computer and use it in GitHub Desktop.
grp = batting_df.groupby('match').first().reset_index()
matches_won = grp[grp['innings_no'] == grp['result']]
print("Over all Winning %:",(matches_won.shape[0]/num)*100)
#Batting first & second
first = grp[grp['innings_no'] == 1]
second = grp[grp['innings_no'] == 2]
#Batting first winning %
won1 = first[first['innings_no'] == first['result']]
print("Batting First Winning % :",(won1.shape[0]/first.shape[0])*100)
#Batting secong winning %
won2 = second[second['innings_no'] == second['result']]
print("Batting Second Winning % :",(won2.shape[0]/second.shape[0])*100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment