@@ -1279,29 +1279,29 @@ def test_concat_ignore_index(self, sort):
1279
1279
1280
1280
tm .assert_frame_equal (v1 , expected )
1281
1281
1282
- concat_index_names = [
1283
- (["idx" , "idx" ], "idx" ),
1284
- (["idx" , None ], "idx" ),
1285
- ([None , None ], None ),
1286
- (["idx1" , "idx2" ], None ),
1287
- (["idx" , "idx" , None ], "idx" ),
1288
- (["idx1" , "idx2" , None ], None ),
1289
- ]
1290
-
1291
- @pytest .mark .parametrize ("input_names,output_name" , concat_index_names )
1282
+ @pytest .mark .parametrize (
1283
+ "input_names,output_name" ,
1284
+ [
1285
+ (["idx" , "idx" ], "idx" ),
1286
+ (["idx" , None ], "idx" ),
1287
+ ([None , None ], None ),
1288
+ (["idx1" , "idx2" ], None ),
1289
+ (["idx" , "idx" , None ], "idx" ),
1290
+ (["idx1" , "idx2" , None ], None ),
1291
+ ],
1292
+ )
1292
1293
def test_concat_same_index_names (self , input_names , output_name ):
1293
1294
# GH13475
1294
- rows = ["a" , "b" , "c" ]
1295
- cols = ["x" , "y" , "z" ]
1296
- vals = [0 , 1 , 2 ]
1297
-
1298
- indices = [pd .Index (rows , name = n ) for n in input_names ]
1299
- frames = [pd .DataFrame ({c : vals }, index = i ) for i , c in zip (indices , cols )]
1295
+ indices = [pd .Index (["a" , "b" , "c" ], name = n ) for n in input_names ]
1296
+ frames = [
1297
+ pd .DataFrame ({c : [0 , 1 , 2 ]}, index = i )
1298
+ for i , c in zip (indices , ["x" , "y" , "z" ])
1299
+ ]
1300
1300
result = pd .concat (frames , axis = 1 )
1301
1301
1302
- exp_ind = pd .Index (rows , name = output_name )
1302
+ exp_ind = pd .Index ([ "a" , "b" , "c" ] , name = output_name )
1303
1303
expected = pd .DataFrame (
1304
- {c : vals for _ , c in zip (input_names , cols )}, index = exp_ind
1304
+ {c : [ 0 , 1 , 2 ] for _ , c in zip (input_names , [ "x" , "y" , "z" ] )}, index = exp_ind
1305
1305
)
1306
1306
1307
1307
tm .assert_frame_equal (result , expected )
0 commit comments