Created
February 16, 2020 14:18
-
-
Save aravindpai/f3fe13c34ff76767bdd2e463335d681c 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
#bowling strike rate | |
sr1 = powerplay_bowling_df.shape[0]/(powerplay_bowling_df[powerplay_bowling_df['event']=='out'].shape[0]) | |
sr2 = middle_bowling_df.shape[0]/(middle_bowling_df[middle_bowling_df['event']=='out'].shape[0]) | |
sr3 = last_bowling_df.shape[0]/(last_bowling_df[last_bowling_df['event']=='out'].shape[0]) | |
#bowling average | |
avg1=np.sum(powerplay_bowling_df['runs'].values)/(powerplay_bowling_df[powerplay_bowling_df['event']=='out'].shape[0]) | |
avg2=np.sum(middle_bowling_df['runs'].values)/(middle_bowling_df[middle_bowling_df['event']=='out'].shape[0]) | |
avg3=np.sum(last_bowling_df['runs'].values)/(last_bowling_df[last_bowling_df['event']=='out'].shape[0]) | |
# A python dictionary | |
data = {"Strike rate":[sr1,sr2,sr3], | |
"Bowling average":[avg1,avg2,avg3] | |
} | |
index = ["Powerplay", "Middle", "Last 5 overs"]; | |
# 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").get_figure() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment