Pandas 创建具有3列的条形图和饼图

Pandas 创建具有3列的条形图和饼图,pandas,matplotlib,Pandas,Matplotlib,我的数据框在下面 Month Sales2015 Sales2016 0 Q3 0.00 13208.52 1 Q4 10500.78 23114.91 2 Q2 0.00 6627.00 3 Q1 19881.00 13254.00 4 Q3 3684.48 0.00 sa[['Month','Sales2015','Sales2016']].plot(kind='bar') 我的代码

我的数据框在下面

  Month  Sales2015  Sales2016
0    Q3       0.00   13208.52
1    Q4   10500.78   23114.91
2    Q2       0.00    6627.00
3    Q1   19881.00   13254.00
4    Q3    3684.48       0.00
sa[['Month','Sales2015','Sales2016']].plot(kind='bar')
我的代码在下面

  Month  Sales2015  Sales2016
0    Q3       0.00   13208.52
1    Q4   10500.78   23114.91
2    Q2       0.00    6627.00
3    Q1   19881.00   13254.00
4    Q3    3684.48       0.00
sa[['Month','Sales2015','Sales2016']].plot(kind='bar')
但是这个图表是不正确的。我需要

在条形图中比较2015年和2016年的季度销售额

创建包含2016年月份和销售额的饼图

我会用


您想按月份和年份添加销售额,然后为每个月创建图表吗?您能在enumerateaxs中为i,ax解释一下吗?axs:agg_df.plot.piey=list_Sales[i],ax=ax with plt.subplot在绘制图表的位置生成两个轴,并对其进行循环引用。但是您可以使用我刚刚发布的第二个解决方案,即如何在char-like上获取值https://stackoverflow.com/questions/41088236/how-to-have-actual-values-in-matplotlib-pie-chart-displayed-python