You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be ok if pd.to_datetime() assumed a default for parameter format, for example either US-format, or ISO-format '%Y/%m/%d %H:%M:%S'.
Anyhow as the code sample show, to_datetime() changes it's assumptions based on each input string. This is not acceptable and can be very harmful. There is no good in such dynamic parsing strategy.
I guess pd.to_datetime() assume a dateformat of '%m-%d-%Y %H:%M:%S', once this assumption is violated, the decoding strategy changes to
'%d-%m-%Y %H:%M:%S' instead of throwing an exception. Such instability is no good. pd.to_datetime() should work according a given date format. First violation according that date format should throw an exception
Expected Output
Any time pd.to_datetime() should work under control of a format string, a datetime string format. This could either be a default or a parameter passed format string.
If no format string is passed as a parameter to_datetime() uses a flexible strategy. As Pandas main scope is to work with DataFrame and Series object, timeseries are a prominent application. Such flexible date format interpretation can here be very destructive. Such behaviour of to_datetime() should not need to be expected and is NOT failsafe.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 7c48ff4
python : 3.8.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : German_Switzerland.1252
[ x] I have checked that this issue has not already been reported.
[ x] I have confirmed this bug exists on the latest version of pandas.
[ x] (optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
It would be ok if pd.to_datetime() assumed a default for parameter format, for example either US-format, or ISO-format '%Y/%m/%d %H:%M:%S'.
Anyhow as the code sample show, to_datetime() changes it's assumptions based on each input string. This is not acceptable and can be very harmful. There is no good in such dynamic parsing strategy.
I guess pd.to_datetime() assume a dateformat of '%m-%d-%Y %H:%M:%S', once this assumption is violated, the decoding strategy changes to
'%d-%m-%Y %H:%M:%S' instead of throwing an exception. Such instability is no good. pd.to_datetime() should work according a given date format. First violation according that date format should throw an exception
Expected Output
Any time pd.to_datetime() should work under control of a format string, a datetime string format. This could either be a default or a parameter passed format string.
If no format string is passed as a parameter to_datetime() uses a flexible strategy. As Pandas main scope is to work with DataFrame and Series object, timeseries are a prominent application. Such flexible date format interpretation can here be very destructive. Such behaviour of to_datetime() should not need to be expected and is NOT failsafe.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 7c48ff4
python : 3.8.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 45 Stepping 7, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : German_Switzerland.1252
pandas : 1.2.5
numpy : 1.20.2
The text was updated successfully, but these errors were encountered: