如何使用 Pandas 数据框绘制时间序列图

时间:2021-04-17 18:14:47

标签: pandas dataframe matplotlib

0          1
0 2019-08-06   1.264652
1 2019-08-10   4.136145
2 2019-08-15  18.981240
3 2019-08-20  15.608667
4 2019-09-07   4.108212

我有一个像这样的 Pandas 数据框,我想根据这个绘制一个时间序列图,我该怎么做。

这就是我正在做的。

df = pd.DataFrame(DATA_LIST)
    print(df.head())
    df.plot()
    plt.show()

但我需要 X 轴上的日期值。

1 个答案:

答案 0 :(得分:0)

 df.plot(x="name of the column with dates", y="name of the column with dates")