@@ -2626,21 +2626,15 @@ def test_index_namedtuple(self):
2626
2626
result = df .loc [IndexType ("foo" , "bar" )]["A" ]
2627
2627
assert result == 1
2628
2628
2629
- def test_index_single_double_tuples (self ):
2629
+ @pytest .mark .parametrize ("tpl" , [tuple ([1 ]), tuple ([1 , 2 ])])
2630
+ def test_index_single_double_tuples (self , tpl ):
2630
2631
# GH 20991
2631
- tuple_1 = tuple ([1 , 2 ])
2632
- tuple_2 = tuple ([1 ])
2633
- idx = pd .Index ([tuple_1 , tuple_2 ], name = "A" , tupleize_cols = False )
2632
+ idx = pd .Index ([tuple ([1 ]), tuple ([1 , 2 ])], name = "A" , tupleize_cols = False )
2634
2633
df = DataFrame (index = idx )
2635
2634
2636
- result = df .loc [[tuple_1 ]]
2637
- idx_1 = pd .Index ([tuple_1 ], name = "A" , tupleize_cols = False )
2638
- expected = DataFrame (index = idx_1 )
2639
- tm .assert_frame_equal (result , expected )
2640
-
2641
- result = df .loc [[tuple_2 ]]
2642
- idx_2 = pd .Index ([tuple_2 ], name = "A" , tupleize_cols = False )
2643
- expected = DataFrame (index = idx_2 )
2635
+ result = df .loc [[tpl ]]
2636
+ idx = pd .Index ([tpl ], name = "A" , tupleize_cols = False )
2637
+ expected = DataFrame (index = idx )
2644
2638
tm .assert_frame_equal (result , expected )
2645
2639
2646
2640
def test_boolean_indexing (self ):
0 commit comments