Skip to content

Commit f927fed

Browse files
committed
BUG: Remove broken frame mod and floordiv str_rep
`%` (modulus) intermittently causes floating point exceptions when used with numexpr. `//` (floordiv) is inconsistent between unaccelerated and accelerated when dividing by zero (unaccelerated produces 0.0000, accelerated produces `inf`)
1 parent 5d69a4d commit f927fed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas/core/frame.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -854,11 +854,16 @@ def __contains__(self, key):
854854
__mul__ = _arith_method(operator.mul, '__mul__', '*', default_axis=None)
855855
__truediv__ = _arith_method(operator.truediv, '__truediv__', '/',
856856
default_axis=None, fill_zeros=np.inf, truediv=True)
857+
# numexpr produces a different value (python/numpy: 0.000, numexpr: inf)
858+
# when dividing by zero, so can't use floordiv speed up (yet)
859+
# __floordiv__ = _arith_method(operator.floordiv, '__floordiv__', '//',
857860
__floordiv__ = _arith_method(operator.floordiv, '__floordiv__',
858861
default_axis=None, fill_zeros=np.inf)
859862
__pow__ = _arith_method(operator.pow, '__pow__', '**', default_axis=None)
860863

861-
__mod__ = _arith_method(operator.mod, '__mod__', '*', default_axis=None, fill_zeros=np.nan)
864+
# currently causes a floating point exception to occur - so sticking with unaccelerated for now
865+
# __mod__ = _arith_method(operator.mod, '__mod__', '%', default_axis=None, fill_zeros=np.nan)
866+
__mod__ = _arith_method(operator.mod, '__mod__', default_axis=None, fill_zeros=np.nan)
862867

863868
__radd__ = _arith_method(_radd_compat, '__radd__', default_axis=None)
864869
__rmul__ = _arith_method(operator.mul, '__rmul__', default_axis=None)

0 commit comments

Comments
 (0)