top of page

Python - Bar Chart - Matplotlib

Basic Bar Chart example to compare Total Assets by Bank in years 2011 - 2020.




from pandas import read_csv


from matplotlib import pyplot


series = read_csv('Assets.csv', header=0, index_col=0, parse_dates=True, squeeze=True)





print(series.head())


series.groupby(['Bank Name'])['Total Assets'].sum().reset_index()


series1=series.groupby(['Bank Name'])['Total Assets'].sum().reset_index()


series1.sort_values(by=['Bank Name'])


series1.plot.bar(color = 'grey',width = 0.8, x="Bank Name", y="Total Assets")


pyplot.show()






32 views0 comments

Recent Posts

See All

Comments


bottom of page