Skip to content

Commit 37b3e61

Browse files
committed
BUG: modulo should not be commutative in general
1 parent e12d6f7 commit 37b3e61

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/core/frame.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,8 @@ def __contains__(self, key):
874874
default_axis=None, fill_zeros=np.inf)
875875
__rpow__ = _arith_method(lambda x, y: y ** x, '__rpow__',
876876
default_axis=None)
877-
__rmod__ = _arith_method(operator.mod, '__rmod__', default_axis=None, fill_zeros=np.nan)
877+
__rmod__ = _arith_method(lambda x, y: y % x, '__rmod__', default_axis=None,
878+
fill_zeros=np.nan)
878879

879880
# boolean operators
880881
__and__ = _arith_method(operator.and_, '__and__', '&')

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ def iteritems(self):
12661266
__rtruediv__ = _arith_method(lambda x, y: y / x, '__truediv__', fill_zeros=np.inf)
12671267
__rfloordiv__ = _arith_method(lambda x, y: y // x, '__floordiv__', fill_zeros=np.inf)
12681268
__rpow__ = _arith_method(lambda x, y: y ** x, '__pow__')
1269-
__rmod__ = _arith_method(operator.mod, '__mod__', fill_zeros=np.nan)
1269+
__rmod__ = _arith_method(lambda x, y: y % x, '__mod__', fill_zeros=np.nan)
12701270

12711271
# comparisons
12721272
__gt__ = _comp_method(operator.gt, '__gt__')

0 commit comments

Comments
 (0)