Skip to content

Commit 0fbd896

Browse files
committed
reformat concat index names test
1 parent 94a8c65 commit 0fbd896

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

pandas/tests/reshape/test_concat.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,29 +1279,29 @@ def test_concat_ignore_index(self, sort):
12791279

12801280
tm.assert_frame_equal(v1, expected)
12811281

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+
)
12921293
def test_concat_same_index_names(self, input_names, output_name):
12931294
# 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+
]
13001300
result = pd.concat(frames, axis=1)
13011301

1302-
exp_ind = pd.Index(rows, name=output_name)
1302+
exp_ind = pd.Index(["a", "b", "c"], name=output_name)
13031303
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
13051305
)
13061306

13071307
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)