Search code examples
pythonpandaspandas.excelwriter

Which arguments is 'FutureWarning: Use of **kwargs is deprecated, use engine_kwargs instead' refering to?


I got the following waring from that code:

    file = r'.\changed_activities.xlsx'
    with pd.ExcelWriter(file,
                        engine='openpyxl',
                        mode='a',
                        if_sheet_exists='new') as writer:
        df.to_excel(writer, sheet_name=activity[0:30])


FutureWarning: Use of **kwargs is deprecated, use engine_kwargs instead. with pd.ExcelWriter(file,

What I can't seem to read from the documentation is which of my arguments I need to replace? the examples are e.g. this, but I don't see how that translates to my code.

with pd.ExcelWriter(
    "path_to_file.xlsx",
    engine="openpyxl",
    mode="a",
    engine_kwargs={"keep_vba": True}
) as writer:
    df.to_excel(writer, sheet_name="Sheet2") 

And maybe in a more open question: how/where can I understand something like that that in a general case?


Solution

  • Use

    pd.ExcelWriter('out.xlsx', engine='xlsxwriter', engine_kwargs={'options':{'strings_to_urls': False}})
    

    Instead of

    pd.ExcelWriter('out.xlsx', engine='xlsxwriter', options={'strings_to_urls': False}})