import pandas as pd import matplotlib.pyplot as plt if __name__ == '__main__': student = pd.read_excel("C:/Users/123/Desktop/pandas/012_饼图/Students.xlsx") print(student.head) student = student.set_index("From") # 设置标签 # 逆时针 # student["2017"].sort_values(ascending = True).plot.pie(fontsize = 8) # 逆时针 student["2017"].plot.pie(fontsize = 8, counterclock = False, startangle = -270) # 逆时针 # 顺时针 # student["2017"].sort_values(ascending = True).plot.pie(fontsize = 8, startangle = -270) # 顺时针 # student["2017"].plot.pie(fontsize = 8, counterclock = False) # 逆时针 plt.title("Source of international Students", fontsize = 16, fontweight = "bold") plt.ylabel("2017", fontsize = 12, fontweight = "bold") plt.show()