Python Pandas导出到CSV无法正确处理逃脱
我有以下问题:我读了一个具有以下顺序的CSV \“ \\\”
哪个熊猫的读数正确(因为如果我打印数据框,它会输出“ \/code>。 /代码>在软件中不起作用的导出CSV使用。
我用来读取CSV的设置:
import = pd.read_csv('input.csv', sep="|", dtype=str, quotechar='"', escapechar="\\")
导出设置:
import.to_csv('export.csv', sep="|", index=False, encoding='utf-8', escapechar="\\", quoting=csv.QUOTE_NONNUMERIC, doublequote=False)
这为我提供了我所拥有的其他所有结果
。
I have the following problem: i read a csv with the following sequence\"\\\"
which pandas reads correctly (because if i print the dataframe it outputs "\"
. But if i now export the dataframe again to csv it will give me the character sequence \"\\"
which is not working in the software the exported csv gets used in.
The settings I use to read the csv:
import = pd.read_csv('input.csv', sep="|", dtype=str, quotechar='"', escapechar="\\")
Export settings:
import.to_csv('export.csv', sep="|", index=False, encoding='utf-8', escapechar="\\", quoting=csv.QUOTE_NONNUMERIC, doublequote=False)
This gives me for everything else I have correct results.
I appreciate any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论