We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e2bbcf commit 37e5a00Copy full SHA for 37e5a00
pandas/tests/indexing/test_multiindex.py
@@ -275,6 +275,24 @@ def test_loc_multiindex(self):
275
xp = mi_int.ix[4]
276
tm.assert_frame_equal(rs, xp)
277
278
+ def test_loc_getitem_partial_int(self):
279
+ # GH 12416
280
+ # with single item
281
+ l1 = [10, 20]
282
+ l2 = ['a', 'b']
283
+ df = DataFrame(index=range(2),
284
+ columns=pd.MultiIndex.from_product([l1, l2]))
285
+ expected = DataFrame(index=range(2),
286
+ columns=l2)
287
+ result = df[20]
288
+ tm.assert_frame_equal(result, expected)
289
+
290
+ # with list
291
292
+ columns=pd.MultiIndex.from_product([l1[1:], l2]))
293
+ result = df[[20]]
294
295
296
def test_loc_multiindex_indexer_none(self):
297
298
# GH6788
0 commit comments