按两列分组并以条形图的百分比表示

时间:2019-12-21 13:57:00

标签: pandas bar-chart percentage

我试图在条形图中以百分比表示以下数据, 我似乎做不到:

enter image description here

这是我的剧情代码:

counts = ds.groupby(['Age','Gender']).Gender.count().unstack()

print(counts) ax = counts.plot(kind='bar',stacked = False,rot=0, colormap = 'Paired')

plt.title('Gender distribution in Age group')

0 个答案:

没有答案