Should DatetimeTZDtype normalize the timezone? · Issue #24713 · pandas-dev/pandas (original) (raw)

The .tz on a Timestamp can differ from the .tz on the array / index it's contained within

In [5]: idx = pd.date_range('2000', periods=4, tz="US/Central")

In [6]: idx.tz Out[6]: <DstTzInfo 'US/Central' LMT-1 day, 18:09:00 STD>

In [7]: idx[0].tz Out[7]: <DstTzInfo 'US/Central' CST-1 day, 18:00:00 STD>

I gather that this is the correct behavior. My question: since DatetimeTZDtype is only really used when attached to an array, should it automatically normalize the user-provided tz to the version that's attached to the array? In code, both of the following

In [11]: pd.DatetimeTZDtype(tz=idx.tz).tz Out[11]: <DstTzInfo 'US/Central' LMT-1 day, 18:09:00 STD>

In [12]: pd.DatetimeTZDtype(tz=idx[0].tz).tz Out[12]: <DstTzInfo 'US/Central' CST-1 day, 18:00:00 STD>

would be equal to the normalized version, Out[11].

originally suggested by @jbrockmendel. cc @mroeschke.