>> freq.is_on_offset(per.to_timestamp()) False >>> per Period('2023-04-06', 'C') The link betwe...">

BUG?: Period allows construction from Custom freqs (original) (raw)

freq = pd.offsets.CustomBusinessDay(weekmask="Mon Wed Fri")

per = pd.Period("2023-04-06", freq=freq)

freq.is_on_offset(per.to_timestamp()) False

per Period('2023-04-06', 'C')

The link between DateOffset and Period is a footgun. In this case, the Period machinery sees this CustomBusinessDay and doesn't distinguish between it and BusinessDay (of which CBDay is a subclass).

Probably should raise on CustomBusinessDay.