Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/cc_14.py

Created Feb 16, 2020
Embed
What would you like to do?
powerplay_bowling_df = powerplay_df[powerplay_df['bowling_team']=='ind']
middle_bowling_df = middle_df[middle_df['bowling_team']=='ind']
last_bowling_df = last_df[last_df['bowling_team']=='ind']
temp = powerplay_bowling_df.groupby('match').apply(lambda x:x['runs'].sum()).reset_index()
avg1=np.median(temp[0].values)
er1 = avg1/6.0
temp = middle_bowling_df.groupby('match').apply(lambda x:x['runs'].sum()).reset_index()
avg2=np.median(temp[0].values)
er2 = avg2/9.0
temp = last_bowling_df.groupby('match').apply(lambda x:x['runs'].sum()).reset_index()
avg3=np.median(temp[0].values)
er3 = avg3/5.0
data = {"Economy rate":[er1,er2,er3] };
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
You can’t perform that action at this time.