Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jbrockmendel opened this issue Feb 18, 2022 · 0 comments
Open

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

jbrockmendel opened this issue Feb 18, 2022 · 0 comments
Labels
API - Consistency Internal Consistency of API/Behavior Bug Numeric Operations Arithmetic, Comparison, and Logical operations

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Feb 18, 2022

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.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member Numeric Operations Arithmetic, Comparison, and Logical operations API - Consistency Internal Consistency of API/Behavior and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Bug Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

1 participant