『开发技术』解决TypeError: Cannot cast Index to dtype M8[D]

213 阅读1分钟

原代码

df.columns = df.columns.astype('M8[D]')

修改为

df.columns = df.columns.astype('M8[ns]')