Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@ Other
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
- Bug in ``Series.list`` methods not preserving the original name. (:issue:`60522`)
- Bug in ``Series.replace`` when the Series was created from an :class:`Index` and Copy-On-Write is enabled (:issue:`61622`)
- Bug in ``divmod`` and ``rdivmod`` with :class:`DataFrame`, :class:`Series`, and :class:`Index` with ``bool`` dtypes failing to raise, which was inconsistent with ``__floordiv__`` behavior (:issue:`46043`)
- Bug in printing a :class:`DataFrame` with a :class:`DataFrame` stored in :attr:`DataFrame.attrs` raised a ``ValueError`` (:issue:`60455`)
- Bug in printing a :class:`Series` with a :class:`DataFrame` stored in :attr:`Series.attrs` raised a ``ValueError`` (:issue:`60568`)
- Fixed bug where the :class:`DataFrame` constructor misclassified array-like objects with a ``.name`` attribute as :class:`Series` or :class:`Index` (:issue:`61443`)
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/ops/array_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ def maybe_prepare_scalar_for_op(obj, shape: Shape):
roperator.rfloordiv,
operator.pow,
roperator.rpow,
divmod,
roperator.rdivmod,
}


Expand Down
28 changes: 28 additions & 0 deletions pandas/tests/arithmetic/test_bool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm


def test_divmod_bool_raises(box_with_array):
# GH#46043 // raises, so divmod should too
ser = Series([True, False])
obj = tm.box_expected(ser, box_with_array)

msg = "operator 'floordiv' not implemented for bool dtypes"
with pytest.raises(NotImplementedError, match=msg):
obj // obj

if box_with_array is DataFrame:
msg = "operator 'floordiv' not implemented for bool dtypes"
else:
msg = "operator 'divmod' not implemented for bool dtypes"
with pytest.raises(NotImplementedError, match=msg):
divmod(obj, obj)

# go through __rdivmod__
with pytest.raises(NotImplementedError, match=msg):
divmod(True, obj)
Loading