BUG/API Series/Index integer floordiv/mod inconsistency · Issue #13843 · pandas-dev/pandas (original) (raw)
Series
looks to be coerced to float
if the result contains NaN
or inf
. Otherwise Index
doesn't. Make it to be consistent in either way.
Code Sample, a copy-pastable example if possible
pd.Series([1]) // pd.Series([0])
#0 inf
# dtype: float64
pd.Index([1]) // pd.Index([0])
# Int64Index([0], dtype='int64')
np.array([1]) // np.array([0])
# array([0])
pd.Series([1]) % pd.Series([0])
#0 NaN
# dtype: float64
pd.Index([1]) % pd.Index([0])
# Int64Index([0], dtype='int64')
np.array([1]) % np.array([0])
# array([0])
output of pd.show_versions()
on current master.