【发布时间】:2021-07-27 10:20:28
【问题描述】:
我用的是pandas,当我做print(df)的时候,结果如下:
open high low close volume
2021-01-26 09:00:00 0.000230 0.000236 0.000228 0.000228 303.813500
2021-01-27 09:00:00 0.000226 0.000230 0.000223 0.000230 1479.338775
[2 rows x 5 columns]
问题是第一个日期列没有名称,并且似乎不被视为实际列(它说它只有 5 列)。如何在第一列输入名称?
【问题讨论】:
-
这是索引,使用
df.index访问它。 -
第一列可能是索引。使用
df = df.rename_axis(index="datetime")