【发布时间】:2016-02-10 21:52:17
【问题描述】:
我有一个数据集:
ReviewDate_year,ReviewDate_month,Sales
2010,11,1
2011,02,2
2011,11,1
2011,12,6
2012,01,11
2012,02,8
2012,03,3
2012,04,1
2012,05,8
2012,06,3
2012,07,1
2012,08,2
2012,09,1
2012,11,1
2012,12,8
2013,01,2
2013,02,2
2013,03,4
2013,04,4
2013,05,7
2013,06,5
2013,07,6
2013,08,4
2013,09,4
2013,10,5
2013,11,3
2013,12,5
2014,01,9
2014,02,4
2014,03,8
2014,04,7
2014,05,3
2014,06,7
2014,07,1
如何在不同的行中按月和不同年份绘制销售额
我当然可以按年完成
df_2013 = df_monthlycount[df_monthlycount['ReviewDate_year'] == 2013]
df_2014 = df_monthlycount[df_monthlycount['ReviewDate_year'] == 2014]
df_2013.plot(x='ReviewDate_month',y='ProductId')
plt.show()
但是如何在一个图表中制作不同年份的线条?
【问题讨论】:
-
没有 pandas 的数据整形:stackoverflow.com/questions/31863083/…
标签: python pandas matplotlib plot