Open
Description
Encountered while writing tests for PR to #23833, where I wanted to use tz_aware_fixture
for testing promotions of datetimes with tz. The following is an equivalent minimal example, but constructed directly.
>>> import pandas as pd
>>> from dateutil.tz import tzlocal
>>> from pandas.core.dtypes.dtypes import DatetimeTZDtype
>>> dtype = DatetimeTZDtype(tz = tzlocal())
>>> s = pd.Series([10 ** 9], dtype=dtype)
The constructor passes, but worryingly, already the repr of s
fails with a huge stacktrace:
>>> s
Traceback (most recent call last):
[~130 lines of stacktrace]
OSError: [Errno 22] Invalid argument
Same goes for s[0]
.
The underlying values are still there though:
>>> s.values
array(['1970-01-01T00:00:01.000000000'], dtype='datetime64[ns]')
>>> s._data
SingleBlockManager
Items: RangeIndex(start=0, stop=1, step=1)
DatetimeTZBlock: 1 dtype: datetime64[ns, tzlocal()]
This seems like a pretty serious regression to me. @mroeschke @jbrockmendel @jreback @TomAugspurger @jorisvandenbossche