Created
February 16, 2020 14:13
-
-
Save aravindpai/24578516ca9d0dbecda7b9d2e5bfd42b 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
#Strike rate | |
score = powerplay_batting_df.groupby(['year','match']).apply(lambda x:x['runs'].sum()).reset_index(name='score') | |
pp=powerplay_batting_df.groupby("year").apply(lambda x:(x['runs'].sum()/x.shape[0])*100).reset_index(name='strike rate') | |
middle=middle_batting_df.groupby("year").apply(lambda x:(x['runs'].sum()/x.shape[0])*100).reset_index(name='strike rate') | |
last=last_batting_df.groupby("year").apply(lambda x:(x['runs'].sum()/x.shape[0])*100).reset_index(name='strike rate') | |
data = {"Powerplay":pp['strike rate'].values, | |
"Middle overs":middle['strike rate'].values, | |
"Last 5 overs":last['strike rate'].values | |
}; | |
index = last['year'].values | |
# Dictionary loaded into a DataFrame | |
dataFrame = pd.DataFrame(data=data, index=index); | |
# Draw a vertical bar chart | |
axes = dataFrame.plot.bar(rot=0, title="Team India batting strike rate") | |
#axes[1].legend(loc=2) | |
fig=axes.get_figure() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment