我按['supplier','date_order']
分组为
Amount
date_order 2011 2012 2013 2014 2015 2016 2017
supplier
fourni 0.000 1667750.000 4243250.000 2530000.000 2080000.000 1036200.000 1217400.000
supp_f 5289670.200 13076233.400 14199000.000 13181860.000 16177800.000 14525880.000 1346400.000
ifou 662250.000 2135750.000 2184150.000 1829800.000 1947880.000 1424820.000 1836100.000
如何在线图中获取每行的供应商数量图?
答案 0 :(得分:2)
您似乎需要先为MultiIndex
选择DataFrame
然后DataFrame.plot
:
df['Amount'].plot()
或者在列中添加Amount
以删除MultiIndex
(由您的聚合函数更改):
df.groupby(['supplier','date_order'])['Amount'].sum().unstack(fill_value=0).plot()
编辑:
转置使用:
df['Amount'].T.plot()