Follow-Up: Unify apply and onOffset implementations by jbrockmendel · Pull Request #18329 · pandas-dev/pandas (original) (raw)
This follows up on #18280, #18278, and #18263.
get_day_of_month is extended to handle business_start and business_end in addition to start and end.
_day_opt attributes are added to YearFoo, QuarterFoo, and MonthFoo offsets. After some more algebraic simplification (done in a separate PR), their apply and onOffset methods will become identical and can be implemented in the base Year, Quarter, and Month classes.
I expect a small performance penalty from calling self._get_offset_day in cases where could hard-code 1, but the benefits of a unified+simplified implementation outweigh that.