Home > other >  FutureWarning: save is not part of the public API in Python
FutureWarning: save is not part of the public API in Python

Time:12-29

I am using Python to convert Pandas df to .xlsx (in Plotly-Dash app.). All working well so far but with this warning tho:

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

How should I modify the code below in order to keep its functionality and stability in future? Thanks!

 writer = pd.ExcelWriter("File.xlsx", engine = "xlsxwriter")

 workbook  = writer.book

 df.to_excel(writer, sheet_name = 'Sheet', index = False)
  
 writer.save()

CodePudding user response:

just replace save with close.

 writer = pd.ExcelWriter("File.xlsx", engine = "xlsxwriter")

 workbook  = writer.book

 df.to_excel(writer, sheet_name = 'Sheet', index = False)
  
 writer.close()
  • Related