Created
February 16, 2020 14:19
-
-
Save aravindpai/67ef7f9901c6aacdb9ae6033026a46d9 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
pp=powerplay_bowling_df.groupby('year').apply(lambda x: x.shape[0] / x[x['event']=='out'].shape[0] ).reset_index(name='strike rate') | |
middle=middle_bowling_df.groupby('year').apply(lambda x: x.shape[0] / x[x['event']=='out'].shape[0] ).reset_index(name='strike rate') | |
last=last_bowling_df.groupby('year').apply(lambda x: x.shape[0] / x[x['event']=='out'].shape[0] ).reset_index(name='strike rate') | |
# A python dictionary | |
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 | |
fig = dataFrame.plot.bar(rot=0, title="Team India bowling performance (Strike rate)").get_figure() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment