Open
Description
objs = ["2016-01-01 01:02:03+05:00", "2016-01-01 01:02:03+06:00", 0]
pd.to_datetime(objs[::-1]) # <- raises with RuntimeError: No active exception to reraise
pd.to_datetime(objs) # <- raises ValueError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pandas/core/tools/datetimes.py", line 1077, in to_datetime
result = convert_listlike(argc, format)
File "pandas/core/tools/datetimes.py", line 449, in _convert_listlike_datetimes
return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
File "pandas/core/tools/datetimes.py", line 480, in _array_strptime_with_fallback
result, timezones = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
File "pandas/_libs/tslibs/strptime.pyx", line 513, in pandas._libs.tslibs.strptime.array_strptime
raise
File "pandas/_libs/tslibs/strptime.pyx", line 342, in pandas._libs.tslibs.strptime.array_strptime
raise ValueError(f"time data \"{val}\" doesn't "
ValueError: time data "0" doesn't match format "%Y-%m-%d %H:%M:%S%z", at position 2