pandas :无法写入excel文件 [英] Pandas: can not write to excel file
本文介绍了 pandas :无法写入excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从文档
writer = ExcelWriter('output.xlsx')
df1.to_excel(writer,'Sheet1')
df2.to_excel(writer,'Sheet2')
writer.save()
我发现我无法写入带有错误的 excel 文件
I found out that I can not write to an excel file with the error
TypeError: copy() got an unexpected keyword argument 'font'
我在 Mac 专业版上使用 Panda 0.16.
I'm using Panda 0.16 on a Mac pro.
写入一个 xls 文件工作得很好.我不坚持有一个 xlsx 文件,只是想知道为什么它不起作用.
writing to an xls file worked just fine. I do not insist in having an xlsx file, just wonder why it does not work.
推荐答案
为了快速解决方案,请替换这个
For fast solution replace this
xcell.style = xcell.style.copy(**style_kwargs)
与
pass
在 pandas/io/excel.py 第 778 行.
At pandas/io/excel.py line 778.
openpyxl 升级了他们的 api,pandas 也需要更新以支持 openpyxl.
openpyxl upgraded their api and pandas also need to be updated for support openpyxl.
这篇关于 pandas :无法写入excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文