Skip to content

Instantly share code, notes, and snippets.

@aravindpai
Created February 16, 2020 14:06
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/4813683c98b48f584c9c0e2d99209979 to your computer and use it in GitHub Desktop.
Save aravindpai/4813683c98b48f584c9c0e2d99209979 to your computer and use it in GitHub Desktop.
df1 = grp.groupby('bowling_team').apply(lambda x:x.shape[0]).reset_index(name='no')
df2=grp.groupby('bowling_team').apply(lambda x: x[x['innings_no']==x['result']].shape[0]).reset_index(name='won')
df2['Win %']=df2['won']/df1['no']
fig=df2.plot.bar(x="bowling_team", y="Win %", rot=0, title="Win % against different teams",figsize=(10,8)).get_figure() #weighted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment