BUG - PeriodIndex.freq.normalize option gets cached per process · Issue #24121 · pandas-dev/pandas (original) (raw)
It seems that whatever normalize option is first called for a PeriodIndex freq it is used for the rest of the process (on a per offset type basis). No matter whether the freq is explicitly overwritten with a freq using a different normalize option. This is NOT the case for the offset kwds.
>>> pd.PeriodIndex(['19910905'], freq=pd.offsets.YearEnd(normalize=True)).freq.normalize
True
>>> pd.PeriodIndex(['19910905'], freq=pd.offsets.YearEnd(normalize=False)).freq.normalize
True
Restart the process
>>> pd.PeriodIndex(['19910905'], freq=pd.offsets.YearEnd(normalize=False)).freq.normalize
False
>>> pd.PeriodIndex(['19910905'], freq=pd.offsets.YearEnd(normalize=True)).freq.normalize
False