Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/cc_5.py

Created Feb 16, 2020
Embed
What would you like to do?
#split into innings
first_innings_df=score[score['innings_no']==1]
second_innings_df=score[score['innings_no']==2]
df1=first_innings_df.groupby('year').apply(lambda x:np.median(x['score'].values)).reset_index(name='score')
df2=second_innings_df.groupby('year').apply(lambda x:np.median(x['score'].values)).reset_index(name='score')
data = {"Batting First": df1['score'].values,
"Batting Second":df2['score'].values
}
index = df1['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 Average",figsize=(10,8)).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.