Skip to content Skip to sidebar Skip to footer

How To Preserve Date Format When Creating An Excel File?

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 imported like that. I

Solution 1:

Try this:

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

Post a Comment for "How To Preserve Date Format When Creating An Excel File?"