I know this question has been asked many times and there are many answers. I followed the previous threads, still not getting my answer.
When I did this, without errors= coerce
df['DATE'] = pd.to_datetime(df['Date'], format= "%d-%b-%Y %H:%M:%S")
I get an error:
ValueError: time data '26-Aug-17 10:11:29' does not match format '%d-%b-%Y %H:%M:%S' (match)
As you can see, I think I have the right format. But still it gives error.
When I do with errors= coerce
according to this post,
df['DATE'] = pd.to_datetime(df['Date'], format= "%d-%b-%Y %H:%M:%S", `errors= coerce`)
This runs fine, but I get NaT
in my DATE
column. For example, like this,
Date X DATE
0 26-Aug-17 10:11:29 95.617378 NaT
1 26-Aug-17 11:11:29 93.617378 NaT
2 26-Aug-17 12:11:29 91.617378 NaT
3 26-Aug-17 13:11:29 90.000000 NaT
I have the format correct and still can not find why am I getting this error. Any thoughts will be helpful.