Skip to content

Commit fe37a44

Browse files
committed
Add test and note
1 parent 380b410 commit fe37a44

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ Indexing
748748
- Bug in :meth:`DataFrame.loc` with inconsistent behavior of loc-set with 2 given indexes to Series (:issue:`59933`)
749749
- Bug in :meth:`Index.get_indexer` and similar methods when ``NaN`` is located at or after position 128 (:issue:`58924`)
750750
- Bug in :meth:`MultiIndex.insert` when a new value inserted to a datetime-like level gets cast to ``NaT`` and fails indexing (:issue:`60388`)
751+
- Bug in :meth:`Series.__setitem__` when assigning boolean series with boolean indexer will raise ``LossySetitemError`` (:issue:`57338`)
751752
- Bug in printing :attr:`Index.names` and :attr:`MultiIndex.levels` would not escape single quotes (:issue:`60190`)
752753
- Bug in reindexing of :class:`DataFrame` with :class:`PeriodDtype` columns in case of consolidated block (:issue:`60980`, :issue:`60273`)
753754

pandas/tests/series/indexing/test_setitem.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,3 +1838,13 @@ def test_setitem_empty_mask_dont_upcast_dt64():
18381838
ser.mask(mask, "foo", inplace=True)
18391839
assert ser.dtype == dti.dtype # no-op -> dont upcast
18401840
tm.assert_series_equal(ser, orig)
1841+
1842+
1843+
def test_setitem_bool_dtype_with_boolean_indexer():
1844+
# GH 57338
1845+
s1 = Series([True, True, True], dtype=bool)
1846+
s2 = Series([False, False, False], dtype=bool)
1847+
condition = [False, True, False]
1848+
s1[condition] = s2[condition]
1849+
expected = Series([True, False, True], dtype=bool)
1850+
tm.assert_series_equal(s1, expected)

0 commit comments

Comments
 (0)