1 import pandas 2 from matplotlib import pyplot 3 excel=pandas.read_excel(\'填充日期.xlsx\') 4 excel.sort_values(by=\'score\',ascending=False,inplace=True) 5 print(excel) 6 7 #开始绘制柱状图 8 #excel.plot.bar(x=\'name\',y=\'score\',color=\'orange\',title=\'score\') 9 pyplot.bar(excel.name,excel.score,color=\'orange\') 10 pyplot.xticks(excel.name,rotation=45) 11 pyplot.yticks(excel.score,rotation=45) 12 13 14 pyplot.tight_layout() #紧凑放置 15 pyplot.show()