# -*-coding:utf-8 -*-
import pandas as pd
import matplotlib.pyplot as plt
students = pd.read_excel('C:/Users/asus/Downloads/pandas/009/Students.xlsx')
students.sort_values(by='Number', inplace=True,ascending=False)
print(students)
# students.plot.bar(x='Field',y='Number',color='red',title='学生图')
plt.bar(students.Field,students.Number,color='orange')
plt.xticks(students.Field,rotation='90')
plt.xlabel('Field')
plt.ylabel('Number')
plt.title('international Students by Field', fontsize=16)
plt.tight_layout()
plt.show()
pandas-matplotlib柱状图
最新推荐文章于 2023-05-29 10:12:41 发布