The behavior of pandas makes sense:
- If the excel-format of your date column is text, pandas will read the
dates as strings by default.
- If the excel-format of your date column is date, pandas will read the dates as dates.
However, you point out that in the Excelfile the date column is formatted as a date. If that's the case, there is no string in your Excelfile to begin with. The underlying data of the date column is stored as a float. The string you are seeing is not the actual data. You can't read something as a raw string if it isn't a string.
Some more info: https://xlrd.readthedocs.io/en/latest/formatting.html
But let's say, for some reason, you want Python to display the same format as Excel, but in string form, without looking in the Excel.
First you'd have to find the format:
from openpyxl import load_workbook
wb = load_workbook('data.xlsx')
ws = wb.worksheets[0]
print(ws.cell(1,5).number_format) # look at the cell you are interested in
> '[$]dd/mm/yyyy;@'
and then convert is to something the strftime function understands.
https://www.programiz.com/python-programming/datetime/strftime#format-code
form = form[3:-2]
form = form.replace('dd','%d')
form = form.replace('mm','%m')
form = form.replace('yyyy','%Y')
print(form)
> '%d/%m/%Y'
And apply it
df.loc[:,"date_field"].apply(lambda x: x.strftime(form))
> 0 01/02/2018
1 02/02/2018
2 03/02/2018
3 04/02/2018
4 05/02/2018
However, if you're working with multiple Excel date-formats you'd have to make a strf-time mapping for each of them.
Probably there will be more practical ways of doing this, like receiving the data in csv format or just keeping the dates in excel's text format in the first place.