Python Forum

Full Version: Help with datatime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello i am beginner with python and i have one problem with datetime in my script.
This is my data set
DATE_y
13.10.2017
19.7.2018
12.10.2018
9.4.2019

DATA['DATE_y2']=pd.to_datetime(DATA['DATE_y'])

This is results
row DATE_y2 DATE_y
1 13.10.2017 13.10.2017
2 19.7.2018 19.7.2018
3 10.12.2018 12.10.2018
4 4.9.2019 9.4.2019

Can you help with with the results? Why is problem in row 3 and 4 ? and row 1 row 2 are correct.
Does anyone know where is the problem?

Thank you so much for your answer.
Check the dayfirst argument in the docs:
https://pandas.pydata.org/pandas-docs/st...etime.html

I'm pretty sure your problem is due to the fact that in America we do dates like MM-DD-YYYY whereas the rest of the world does the more logical DD-MM-YYYY. Of course we should all be using the best choice which is YYYY-MM-DD but what are you gonna do?
I checked it. The dayfirst was problem. I repaired it . Thank you so much.