-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: to_datetime issue parsing non-zero padded month in 0.17.1 #11871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It sounds like the following works :
This could be related to #11142 and considered as a regression. Having to guess the datetime_format when the given format is the appropriate one is overkilll:
|
This PR (conveniently also mine) is a more likely cause for the problem - I'll take a look later. |
This happens because there is a special fastpath (in C) for iso8601 formatted dates, but that code doesn't handle dates without leading 0s. As a workaround, you can just not specify the format - To fix this, probably either need to:
|
@chris-b1 The second option is definitely the best one as it would keep the behaviour closer to the standard behaviour of strptime. Even if it is not performance neutral, it should not add a serious overhead to support no leading-zero's in the C code. |
yes, more flexibility is good here. BTW this is quite straightforward to do as this is pretty straightforward c-code. |
to_datetime
issue parsing non-zero padded month in 0.17.1
In pandas 0.16.2, the following date (non-zero padded month) was parsing correctly:
With 0.17.1, it raises a ValueError:
Even if
%m
is supposed to be used for zero-padded month definitions, Python's strptime function parses them properly.Is this a known issue?
The text was updated successfully, but these errors were encountered: