0

I am trying to send data to an .xlsx file. The file is being created however in the file it is saying that tablo_text.xlsx is not UTF-8 encoded. Saving disabled.

The code:

import numpy as np
import pandas as pd
list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
a = np.array(list)
a = a.reshape(4,4)
tablo = pd.DataFrame(a, index=["a", "b", "c", "d"], columns=["x","y","z","t"])
tablo.to_excel("tablo_text.xlsx", encoding='UTF-8')
MDR
  • 2,610
  • 1
  • 8
  • 18
  • Same error as https://stackoverflow.com/questions/61114350/. The linked question/answer implies you can ignore it. FYI I ran your code and the file opens fine. – MDR Aug 26 '21 at 22:41
  • According to the [documentation](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_excel.html), *encoding* is only a necessary parameter for `.xlwt` and other writers support Unicode natively. So drop the parameter. – Mark Tolonen Aug 27 '21 at 06:06
  • It is same when I drop the parameter. thank you – Meltem Karadağlı Aug 30 '21 at 18:18

0 Answers0