def get_city_education():
city_education = pd.crosstab(frame.city,frame.education,margins=True).sort_values(by='All',ascending=False)[:11]
city_education = city_education.drop('All',axis=0).drop('All',axis=1)
ce_chart = pygal.Bar()
ce_chart.title = u'??????????????'
ce_chart.x_labels = city_education.index
for i in range(len(list(city_education.T.index))):
ce_chart.add(city_education.T.index[i], city_education.T.values[i])
ce_chart.render_to_file(os.path.dirname(__file__) + '/chart/city_edu.svg')
评论列表
文章目录