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
I left this alone, but should an empty string just be a NaT (like we do elsewhere), even when a formatis present?
In [1]: td = pd.Series(['May 04', 'Jun 02', ''], index=[1, 2, 3])
In [2]: td
Out[2]:
1 May 04
2 Jun 02
3
dtype: object
In [3]: pd.to_datetime(td, format='%b %y', errors='coerce')
Out[3]:
1 2004-05-01
2 2002-06-01
3 NaT
dtype: datetime64[ns]
In [4]: pd.to_datetime(td, format='%b %y', errors='raise')
ValueError: time data '' does not match format '%b %y' (match)
related is that we don't coerce empty strings here either (and we have an odd error message).
In [1]: pd.to_datetime([1, ''], unit='s', errors='coerce')
Out[1]: DatetimeIndex(['1970-01-01 00:00:01', 'NaT'], dtype='datetime64[ns]', freq=None)
In [2]: pd.to_datetime([1, ''], unit='s')
ValueError: invalid literal for long() with base 10: ''
The text was updated successfully, but these errors were encountered:
after #13033
I left this alone, but should an empty string just be a
NaT
(like we do elsewhere), even when aformat
is present?related is that we don't coerce empty strings here either (and we have an odd error message).
The text was updated successfully, but these errors were encountered: