I am using a dataframe which has a 'Date' column. I have used pd.to_datetime()
to convert this column format to yyyy-mm-dd. However, this format is getting switched to some other format at intermittent dates in the dataframe (eg: yyyy-dd-mm).
Date
2021-02-01 <----- this is 2nd Jan, 2021
2021-01-21 <----- this is 21st Jan, 2021
Further, I have alto tried using the df['Date'].dt.strftime('%y-%m-%d')
, but this too has not helped.
I request some guidance on the following points:
- For any Date column, is it enough to just use pd.to_datetime() and be rest assured that all dates will be in correct format?
- Or do I need to manually state the datetime format explicitly alongwith the pd.to_[enter image description here][1]datetime() feature?