BUG: to_datetime issue parsing non-zero padded month in 0.17.1 · Issue #11871 · pandas-dev/pandas (original) (raw)

In pandas 0.16.2, the following date (non-zero padded month) was parsing correctly:

>>> import pandas
>>> pandas.__version__
'0.16.2'
>>> pandas.to_datetime('2005-1-13', format='%Y-%m-%d')
Timestamp('2005-01-13 00:00:00')

With 0.17.1, it raises a ValueError:

>>> import pandas
>>> pandas.__version__
u'0.17.1'
>>> pandas.to_datetime('2005-1-13', format='%Y-%m-%d')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dpinte/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/util/decorators.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/Users/dpinte/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/tseries/tools.py", line 276, in to_datetime
    unit=unit, infer_datetime_format=infer_datetime_format)
  File "/Users/dpinte/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/tseries/tools.py", line 397, in _to_datetime
    return _convert_listlike(np.array([ arg ]), box, format)[0]
  File "/Users/dpinte/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pandas/tseries/tools.py", line 383, in _convert_listlike
    raise e
ValueError: time data '2005-1-13' does match format specified

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?