每行熊猫有多个饼图

Pen*_*ang 2 charts matplotlib dataframe pandas

我想为每个大陆创建多个饼图,以显示其上所含酒精含量的百分比。数据框

谢谢

jez*_*ael 5

您可以通过以下方式DataFrame.plot.pie使用转置数据帧T

df = pd.DataFrame({'beer':[1,2,3],
                   'spirit':[4,5,6],
                   'wine':[7,8,9]}, index=['Africa','Asia','Europe'])

print (df)
        beer  spirit  wine
Africa     1       4     7
Asia       2       5     8
Europe     3       6     9

df.T.plot.pie(subplots=True, figsize=(10, 3))
Run Code Online (Sandbox Code Playgroud)

图形