Skip to content

BUG/API Series/Index integer floordiv/mod inconsistency #13843

Closed
@sinhrks

Description

@sinhrks

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.

Metadata

Metadata

Assignees

Labels

BugNumeric OperationsArithmetic, Comparison, and Logical operations

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions