Skip to content

BUG/API: Series[bool] floordiv raises but divmod does not #46043

@jbrockmendel

Description

@jbrockmendel
ser = pd.Series([True, False])

ser // ser  # <- raises

divmod(ser, ser)  # <- does not raise

In a number of places, specifically the extension tests TestArithmeticOps._check_divmod_op, we check for internal consistency with something like

res = divmod(obj, other)[0]
expected = obj // other
tm.assert_equal(res, expected)

In trying to adapt BooleanArray behavior to match non-masked bool dtype Series behavior (xref #41165) I found that Series[bool] raises on floordiv but allows divmod.

Either both should raise or neither.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/BehaviorBugNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions