Pandas pd.to_excel 报错

报错翻译:

未来警告: 由于 xlwt 软件包已不再维护,xlwt 引擎将在未来版本的 pandas 中移除。这是 pandas 中唯一支持写入 xls
格式文件的引擎。请安装 openpyxl 并改写为 xlsx 文件。你可以将io.excel.xls.writer选项设置为
“xlwt”,以消除此警告。虽然该选项已被弃用,而且也会引发警告,但可以全局设置该选项并抑制警告。
Y.to_excel(‘I:/stereo vision/cy.xls’)

报错原文:

F:\FFlie\paper learning\y.py:137: FutureWarning: As the xlwt package is no longer maintained, the 
xlwt engine will be removed in a future version of pandas. This is the only engine in pandas that 
supports writing in the xls format. Install openpyxl and write to an xlsx file instead. You can set 
the option io.excel.xls.writer to 'xlwt' to silence this warning. While this option is deprecated 
and will also raise a warning, it can be globally set and the warning suppressed.
  Y.to_excel('I:/stereo vision/cy.xls')

解决方法

1、安装第三方模块:openpyxl
pip install openpyxl

2、已安装了的,使用.to_excel语句如下:

Y.to_excel(r'I:/stereo vision/cy.xls',engine='openpyxl')

即可