Tengis Tengis - 7 months ago 89
Python Question

Pandas: can not write to excel file

Trying this example from the documentation

writer = ExcelWriter('output.xlsx')
df1.to_excel(writer,'Sheet1')
df2.to_excel(writer,'Sheet2')
writer.save()


I found out that I can not write to an excel file with the error

TypeError: copy() got an unexpected keyword argument 'font'


I'm using Panda 0.16 on a Mac pro.

EDIT:
writing to an xls file worked just fine. I do not insist in having an xlsx file, just wonder why it does not work.

Answer

For fast solution replace this

xcell.style = xcell.style.copy(**style_kwargs)

with

pass

At pandas/io/excel.py line 778.

openpyxl upgraded their api and pandas also need to be updated for support openpyxl.