升级了Python然后pandas写的ExcelWriter也跟着升级了,然后执行原来的导数据到Excel代码报错警告

提示save()已经是过时的用法

writer = pd.ExcelWriter("excel_path.xlsx")
..... 
writer.save()

FutureWarning: save is not part of the public API, usage can give in unexpected results and will be removed in a future version

解决办法

升级之后,writer.save()接口已经私有化,调用close()即可

writer = pd.ExcelWriter("excel_path.xlsx")
#..... 
#writer.save()
writer.close()

核实查看writer.close()接口里面源码里面自带调用save()方法后才执行关闭接口

升级Pythonpandas执行原来的代码ExcelWriter报错警告: FutureWarning: save is not part of the public API, usage can give unexpected results and will be removed in a future version target_excel.save()

原文地址:https://blog.csdn.net/xuexijiaoliu/article/details/128681541

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_41148.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注