python饼状图表
# coding=utf-8
import pandasas pd
import matplotlib.pyplotas plt
#导入excel文件,指定列索引,对象实例化
DataFrame=pd.read_excel('d:/temp/students.xlsx',index_col='From')
#实例2016年数据,然后对数据进行由大到小的排列,画出饼状图,定义一些对象属性
DataFrame['2016'].sort_values(ascending=True).plot.pie(fontsize=8,startangle=90)
#添加图表的标题
plt.title("source of International Students" ,fontsize=18,fontweight='bold',loc='right')
#添加图表的y轴标签,并定义属性
plt.ylabel('2016',fontsize=18,fontweight='bold')
#显示图表
plt.show()
print(DataFrame)