I have the following code:
import pandas as pd x = [u\'string with some unicode: \\x16\'] df = pd.DataFrame(x)
If I try to write this datafram
The same problem happened to me. I solved it as follows:
First, install python package xlsxwriter:
pip install xlsxwriter
Second, replace the default engine 'openpyxl' with 'xlsxwriter':
df.to_excel("test.xlsx", engine='xlsxwriter')