Created
February 16, 2020 14:05
-
-
Save aravindpai/4ddb59ddd95942f3f1d80c3c5bbfeef7 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
#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