pandas-matplotlib叠加柱状图,水平柱状图

# -*-coding:utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt

users = pd.read_excel('C:/Users/asus/Downloads/pandas/011/Users.xlsx')
users['Total'] = users['Oct']+users['Nov']+users['Dec']
users.sort_values(by='Total',inplace=True)
print(users)

users.plot.bar(x='Name',y=['Oct','Nov','Dec'],stacked=True,title='User Behavior')
plt.tight_layout()
plt.show()

你可能感兴趣的:(pandas数据分析)