@@ -453,6 +453,22 @@ def test_multiindex_loc_order():
453
453
exp_index = pd .MultiIndex .from_arrays ([["b" , "b" , "a" , "a" ], [1 , 2 , 1 , 2 ]])
454
454
tm .assert_index_equal (res .index , exp_index )
455
455
456
+ res = df .loc [["a" , "b" ], :]
457
+ exp_index = pd .MultiIndex .from_arrays ([["a" , "a" , "b" , "b" ], [1 , 2 , 1 , 2 ]])
458
+ tm .assert_index_equal (res .index , exp_index )
459
+
460
+ res = df .loc [(["a" , "b" ], [1 , 2 ]), :]
461
+ exp_index = pd .MultiIndex .from_arrays ([["a" , "a" , "b" , "b" ], [1 , 2 , 1 , 2 ]])
462
+ tm .assert_index_equal (res .index , exp_index )
463
+
464
+ res = df .loc [(["a" , "b" ], [2 , 1 ]), :]
465
+ exp_index = pd .MultiIndex .from_arrays ([["a" , "a" , "b" , "b" ], [2 , 1 , 2 , 1 ]])
466
+ tm .assert_index_equal (res .index , exp_index )
467
+
456
468
res = df .loc [(["b" , "a" ], [2 , 1 ]), :]
457
469
exp_index = pd .MultiIndex .from_arrays ([["b" , "b" , "a" , "a" ], [2 , 1 , 2 , 1 ]])
458
470
tm .assert_index_equal (res .index , exp_index )
471
+
472
+ res = df .loc [(["b" , "a" ], [1 , 2 ]), :]
473
+ exp_index = pd .MultiIndex .from_arrays ([["b" , "b" , "a" , "a" ], [1 , 2 , 1 , 2 ]])
474
+ tm .assert_index_equal (res .index , exp_index )
0 commit comments