Pandas: plot multiple time series DataFrame into a single plot

后端 未结 2 1974
感情败类
感情败类 2021-01-04 02:55

I have the following pandas DataFrame:

     time      Group      blocks
0     1        A           4
1     2        A           7
2     3        A                    


        
2条回答
  •  感动是毒
    2021-01-04 03:25

    You can re-structure the data as a pivot table:

    df.pivot_table(index='time',columns='Group',values='blocks',aggfunc='sum').plot()
    

提交回复
热议问题