Skip to content

Commit e606f33

Browse files
committed
Add test
1 parent e38dc1c commit e606f33

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v1.2.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ Indexing
470470
- Bug in :meth:`Index.where` incorrectly casting numeric values to strings (:issue:`37591`)
471471
- Bug in :meth:`Series.loc` and :meth:`DataFrame.loc` raises when numeric label was given for object :class:`Index` although label was in :class:`Index` (:issue:`26491`)
472472
- Bug in :meth:`DataFrame.loc` returned requested key plus missing values when ``loc`` was applied to single level from :class:`MultiIndex` (:issue:`27104`)
473+
- Bug in :meth:`Series.loc` raised an Error when input was filtered with a boolean list and values to set were a list with lower dimension (:issue:`20438`)
473474

474475
Missing
475476
^^^^^^^

pandas/tests/indexing/test_loc.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,13 @@ def test_loc_setitem_dt64tz_values(self):
19551955
result = s2["a"]
19561956
assert result == expected
19571957

1958+
def test_loc_setitem_boolean_list(self):
1959+
# GH: 20438
1960+
ser = Series([0, 1, 2])
1961+
ser.loc[[True, False, True]] = [5, 10]
1962+
expected = Series([5, 1, 10])
1963+
tm.assert_series_equal(ser, expected)
1964+
19581965

19591966
@pytest.mark.parametrize("value", [1, 1.5])
19601967
def test_loc_int_in_object_index(frame_or_series, value):

0 commit comments

Comments
 (0)