Prevent passing invalid kwds to DateOffset constructors by jbrockmendel · Pull Request #18226 · pandas-dev/pandas (original) (raw)

_use_relativedelta is defined at the class level, defaults to False. So setting again here is unnecessary.

The bigger issue with _relativedelta&_offset is that they are only actually relevant for DateOffset (i.e. not subclasses). It took me a while to figure this out (and in fact I screwed up several PRs back by changing BusinessFoo.offset --> BusinessFoo._offset "for consistency" without realizing the business version is used differently). My current thought is to separate out the relativedelta-using parts of DateOffset into a subclass that isnt inherited by everything else to avoid this confusion.