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