BUG: Consistent division by zero behavior for Index/Series by jbrockmendel · Pull Request #27321 · pandas-dev/pandas (original) (raw)
We have two very-similar functions for masking division by zero for Index vs Series. The Index version is the more correct of the two, so I'm trying to make the Series one behave more like the Index one, eventually just using the Index one for both.
The hard part here is that IntegerArray, SparseArray, and SparseSeries have their own arithmetic implementations, and we test that they behave the same as Series. Several attempts to patch these implementations have failed (and motivated #27302, which this is rebased on top of), so for now this PR patches the tests instead of the implementations.
I think the IntegerArray implementation should be relatively easy to patch. SparseArray I'll need some help (cc @TomAugspurger) with __setitem__
and/or putmask
.