栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

【FutureWarning: As the xlwt package is no longer maintained……】

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【FutureWarning: As the xlwt package is no longer maintained……】

项目场景:

读写EXCEL表


问题描述

D:/pycharm/time_series/gui/SpecialValueProcessingDialog.py:49: 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. data.to_excel(save_file_path)

data = pd.read_excel(open_file_path,sheet_name=0,header=header,index_col=index_col)
print(data.head())
data.replace([-9999,0],np.nan)
data.to_excel(save_file_path)

原因分析:

警告翻译过来:由于xlwt软件包不再维护,xlwt引擎将在未来版本的pandas中删除。这是pandas中唯一支持xls格式写入的引擎。安装openpyxl并改为写入xlsx文件。您可以设置选项io.excel.xls文件。写入“xlwt”以消除此警告。虽然此选项已弃用,并且还会引发警告,但可以全局设置它并抑制警告。


解决方案:

保存excel表时保存为.xlsx格式,而不是.xls格式,就不会有警告

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/834674.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号