File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,26 @@ def test_loc_multiindex(self):
275
275
xp = mi_int .ix [4 ]
276
276
tm .assert_frame_equal (rs , xp )
277
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
+ df = DataFrame (index = range (2 ),
292
+ columns = pd .MultiIndex .from_product ([l1 , l2 ]))
293
+ expected = DataFrame (index = range (2 ),
294
+ columns = pd .MultiIndex .from_product ([l1 [1 :], l2 ]))
295
+ result = df [[20 ]]
296
+ tm .assert_frame_equal (result , expected )
297
+
278
298
def test_loc_multiindex_indexer_none (self ):
279
299
280
300
# GH6788
You can’t perform that action at this time.
0 commit comments