Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
BUG: to_datetime issue parsing non-zero padded month in 0.17.1 #11871
Comments
dpinte
commented
Dec 20, 2015
|
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:
|
jorisvandenbossche
added Bug Timeseries
labels
Dec 22, 2015
jorisvandenbossche
added this to the
0.18.0
milestone
Dec 22, 2015
dpinte
commented
Dec 29, 2015
|
@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. |
dpinte commentedDec 20, 2015
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
%mis supposed to be used for zero-padded month definitions, Python's strptime function parses them properly.Is this a known issue?