我正在尝试使用to_excel()
方法将数据框导出到 .xls 文件。但是在执行时它抛出了一个错误:"UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 892: ordinal not in range(128)"
. 就在几分钟前,它工作正常。
我使用的代码是:
:csv2.to_excel("C:\\Users\\shruthi.sundaresan\\Desktop\\csat1.xls",sheet_name='SAC_STORE_DATA',index=False).
csv2 是数据框。为什么会发生这种错误以及将来如何避免这种错误?