I have a weird date format in my data. I currently have 01oct2012 and I would like 01-10-2012. Can someone help me change it! Thank you!
I tried using the pd.to_datetime, but I dont think I have the right code.
I have a weird date format in my data. I currently have 01oct2012 and I would like 01-10-2012. Can someone help me change it! Thank you!
I tried using the pd.to_datetime, but I dont think I have the right code.
As mentioned above this question has many answers. Taking just 1 date as an example:
ts = pd.to_datetime('01oct2012')
produces the timestamp:
Timestamp('2012-10-01 00:00:00')
To convert to the desired format:
ts.strftime('%d-%m-%Y')
yields:
'01-10-2012'