Pandas mod 0 should not give 0 · Issue #3590 · pandas-dev/pandas (original) (raw)

In python:
3 % 0
is undefined and returns "ZeroDivisionError: integer division or modulo by zero"

But in pandas 0.11, that gives 0. I believe that is incorrect. It ought to give NaN or Inf

p = pandas.DataFrame({ 'first' : [3,4,5,8], 'second' : [0,0,0,3] })
p['mod'] = p['first'] % p['second']
p