BUG: Behaviour change in 1.5.0 when using Timedelta as Enum data type by krasch · Pull Request #49579 · pandas-dev/pandas (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had added a question re: this but somehow github ate it, weird..
Anyway, here is my concern, if I make the change you are suggesting
td1 = MyTimedeltaSubclass("10 minutes")
td2 = Timedelta ("10 minutes")
then result types will be inconsistent
td1 + td2 -> MyTimedeltaSubclass
td2 + td1 -> Timedelta
Maybe that is fine, but it also kinda weirded me out, which is why I wanted to ask you. It feels a little bit like it should be the responsibility of the subclass to implement the custom __add__
behaviour.
Wondering: does the rest of pandas respect subclasses in this way?