10000 BUG: Fix __truediv__ numexpr error by jtratner · Pull Request #3764 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix __truediv__ numexpr error #3764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 18, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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`)
  • Loading branch information
jtratner committed Jun 18, 2013
commit f927fed36323d94afa1f77cf19063c114e43bbfc
7 changes: 6 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,16 @@ def __contains__(self, key):
__mul__ = _arith_method(operator.mul, '__mul__', '*', default_axis=None)
__truediv__ = _arith_method(operator.truediv, '__truediv__', '/',
default_axis=None, fill_zeros=np.inf, truediv=True)
# numexpr produces a different value (python/numpy: 0.000, numexpr: inf)
# when dividing by zero, so can't use floordiv speed up (yet)
# __floordiv__ = _arith_method(operator.floordiv, '__floordiv__', '//',
__floordiv__ = _arith_method(operator.floordiv, '__floordiv__',
default_axis=None, fill_zeros=np.inf)
__pow__ = _arith_method(operator.pow, '__pow__', '**', default_axis=None)

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

__radd__ = _arith_method(_radd_compat, '__radd__', default_axis=None)
__rmul__ = _arith_method(operator.mul, '__rmul__', default_axis=None)
Expand Down
0