Python Pandas AttributeError:保存 csv 时“索引”对象没有属性“_format_native_types”

问题描述 投票:0回答:1

尝试将文件保存到 CSV 时遇到此错误

AttributeError: 'Index' object has no attribute '_format_native_types'
。它可以正确保存在 XLSX 中。我重新安装电脑后就开始出现这种情况,之前运行得很好。 我尝试了 chatgpt 并得到了
here's a problem with how Pandas is trying to handle the index of your DataFrame during the CSV export process. 
建议
dataset.reset_index(drop=True, inplace=True)
但这并没有解决问题。

python pandas csv
1个回答
0
投票

重启电脑后问题解决。不确定原因。

© www.soinside.com 2019 - 2024. All rights reserved.