简体   繁体   中英

Pandas plot series with series names in one row

I have a csv file like this

date, name, value
2016-09-01, alice, 10
2016-09-02, alice, 11
2016-09-01, bob, 8
2016-09-02, bob, 14

With pandas can I plot as a line chart? Or must I change the structure of the file to something similar to

date, alice, bob
2016-09-01, 10, 8
2016-09-02, 11, 14

旋转数据框以绘制每列一条曲线:

df.pivot(index='date', columns='name').plot()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM