小编Jam*_*ang的帖子

将pandas(multi)索引解析为datetime

我有多索引df如下

                x  y
id  date            
abc 3/1/1994  100  7
    9/1/1994   90  8
    3/1/1995   80  9
Run Code Online (Sandbox Code Playgroud)

日期存储为str.

我想解析日期索引.以下声明

df.index.levels[1] = pd.to_datetime(df.index.levels[1])
Run Code Online (Sandbox Code Playgroud)

返回错误:

TypeError: 'FrozenList' does not support mutable operations.
Run Code Online (Sandbox Code Playgroud)

python pandas

10
推荐指数
1
解决办法
3280
查看次数

标签 统计

pandas ×1

python ×1