美文网首页zhaoyqiu的数据分析进阶之路2.0
转载:python在使用df.to_excel()导出文件时报错

转载:python在使用df.to_excel()导出文件时报错

作者: 喝奶茶不加奶茶 | 来源:发表于2020-09-10 18:35 被阅读0次

问题描述:

在使用pandas写excel的时候,可能会出现 “IllegalCharacterError” 的错误提示 。

原因探究:

查了很多技术贴说是欲导出的excel文件中,存在非法字符造成的。

解决方案:

使用xlsxwriter模块,添加指定参数engine='xlsxwriter',自动去除非法字符。

import xlsxwriter
outputData.to_excel(outputExcelFilePath, engine='xlsxwriter')

https://www.pythonheidong.com/blog/article/235674/

相关文章

网友评论

    本文标题:转载:python在使用df.to_excel()导出文件时报错

    本文链接:https://www.haomeiwen.com/subject/glapektx.html