【发布时间】:2014-03-27 23:37:25
【问题描述】:
我正在寻找在 datetime 中转换 read_csv 读取的索引,但这需要很长时间(超过 1 分钟)。
有人知道更有效的方法吗(其他命令,使用 cython,...)?
>>> df
<class 'pandas.core.frame.DataFrame'>
Index: 3367200 entries, 2014/02/28 to 2017/12/31
Columns: 3 entries, SCENARIO to 0
dtypes: float64(1), object(2)
>>> df.index = pd.to_datetime(df.index)
【问题讨论】:
-
你在用 read_csv 解析日期吗?
-
我做 df = pd.read_csv(filename, sep='\t', index_col=[0,1]) 并且日期在 col1 中