Reputation: 1812
main.py:697: FutureWarning: Use of **kwargs is deprecated, use engine_kwargs instead. Excelwriter = pd.ExcelWriter(Excel_File_Name,engine="xlsxwriter",options={'strings_to_numbers': True})
I'm getting this warning while saving the excel sheet. I've tried the following to convert the string values to int:-
Excelwriter = pd.ExcelWriter(Excel_File_Name,engine="xlsxwriter",options={'strings_to_numbers': True})
I found this (options={'strings_to_numbers': True}) solution to convert string to int while saving the excel sheet and tried other methods as well but none seems to be working.
Edit1:-
My Final code looks like this, but the strings aren't converted to Int yet:-
dflist= [Income_Statement_Annual]
Excel_File_Name = Company_name + ".xlsx"
Excelwriter = pd.ExcelWriter(Excel_File_Name,engine="xlsxwriter",engine_kwargs={'options': {'strings_to_numbers': True}})
for df in dflist:
df.to_excel(Excelwriter, sheet_name=retrieve_name(df)[0],index=False)
Excelwriter.save()
Screenshot of My sheet: -
Anything still wrong?
Upvotes: 1
Views: 1530
Reputation: 14216
The documentation here and the error message are pretty clear about how you should make the method call.
Excelwriter = pd.ExcelWriter(
Excel_File_Name,
engine="xlsxwriter",
engine_kwargs={"options": {"strings_to_numbers": True}}
)
Any options specific to the engine
have to be passed in as a dict
to the engine_kwargs
keyword argument.
Upvotes: 2