Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/cc_16.py

Created Feb 16, 2020
Embed
What would you like to do?
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
You can’t perform that action at this time.