Skip to content
Merged
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
18 changes: 18 additions & 0 deletions pandas/tests/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,24 @@ def test_loc_getitem_access_none_value_in_multiindex(self):
result = ser.loc[("Level1", "Level2_a")]
assert result == 1

def test_loc_setitem_multiindex_slice(self):
# GH 34870

index = pd.MultiIndex.from_tuples(
zip(
["bar", "bar", "baz", "baz", "foo", "foo", "qux", "qux"],
["one", "two", "one", "two", "one", "two", "one", "two"],
),
names=["first", "second"],
)

result = Series([1, 1, 1, 1, 1, 1, 1, 1], index=index)
result.loc[("baz", "one"):("foo", "two")] = 100

expected = Series([1, 1, 100, 100, 100, 100, 1, 1], index=index)

tm.assert_series_equal(result, expected)


def test_series_loc_getitem_label_list_missing_values():
# gh-11428
Expand Down