AttributeError with divmod(Series, Series) with 0 in the denominator · Issue #26987 · pandas-dev/pandas (original) (raw)

Strange one. This works,

In [41]: divmod(a, pd.Series([0, 2]));

AttributeError Traceback (most recent call last) in ----> 1 divmod(a, pd.Series([0, 2]));

~/sandbox/pandas/pandas/core/ops.py in wrapper(left, right) 1714 rvalues = rvalues.values 1715 -> 1716 result = safe_na_op(lvalues, rvalues) 1717 return construct_result(left, result, 1718 index=left.index, name=res_name, dtype=None)

~/sandbox/pandas/pandas/core/ops.py in safe_na_op(lvalues, rvalues) 1660 try: 1661 with np.errstate(all='ignore'): -> 1662 return na_op(lvalues, rvalues) 1663 except Exception: 1664 if is_object_dtype(lvalues):

~/sandbox/pandas/pandas/core/ops.py in na_op(x, y) 1640 result = masked_arith_op(x, y, op) 1641 -> 1642 result = missing.fill_zeros(result, x, y, op_name, fill_zeros) 1643 return result 1644

~/sandbox/pandas/pandas/core/missing.py in fill_zeros(result, x, y, name, fill) 544 mask = ((y == 0) & ~np.isnan(result)).ravel() 545 --> 546 shape = result.shape 547 result = result.astype('float64', copy=False).ravel() 548

AttributeError: 'tuple' object has no attribute 'shape'