How to preserve date format when creating an Excel file?

后端 未结 1 1253
花落未央
花落未央 2021-01-28 19:30

I have an .xlsx file that I import into Python and create a Pandas dataframe. One of the columns in the .xlsx file is formatted as a date, mm-dd-yyyy and gets i

1条回答
  •  无人及你
    2021-01-28 19:50

    Try this:

    writer = pd.ExcelWriter('Sample_Master_Data_edited.xlsx', engine='xlsxwriter', 
                            date_format='mm/dd/yyyy', datetime_format='mm/dd/yyyy')
    

    0 讨论(0)
提交回复
热议问题