python pandas ExcelWriter警告:save is not part of the public API, will be removed in a future version

升级了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()方法后才执行关闭接口。

升级Python和pandas后执行原来的代码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()

你可能感兴趣的:(python)