-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Closed
Labels
Description
Code Sample, a copy-pastable example if possible
import pandas as pd
str1='05-01-2019 00:37'
date1=pd.to_datetime(str1).date()
print(date1)
# output 2019-05-01
str2='15-01-2019 00:37'
date2=pd.to_datetime(str2).date()
print(date2)
# output 2019-01-15
Problem description
pd.to_datetime( ) is giving inconsistant out put, in the first piece of code where 01 is month and 05 is date after conversion these values have interchanged 01 as date and 05 as month.
but for similar code where the string value has 15 as date and 01 as month after conversion remained the same as expected.
I have tried .astype(‘datetime64’) and this also yielded the same wrong values as above code
Is this a known Issue and please provide workaround