在对文件进行一些编辑后,我试图将 csv 保存到文件夹中。
每次我使用 pd.to_csv('C:/Path of file.csv')
csv 文件都有一个单独的索引列。我想避免将索引打印到 csv。
我试过了:
pd.read_csv('C:/Path to file to edit.csv', index_col = False)
并保存文件…
pd.to_csv('C:/Path to save edited file.csv', index_col = False)
但是,我仍然得到了不需要的索引列。保存文件时如何避免这种情况?
原文由 Alexis 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用
index=False
。