Skip to content

TST GH 29699 multilevel column is called after multiple appends #36230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pandas/tests/reshape/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,22 @@ def test_concat_rename_index(self):
tm.assert_frame_equal(result, exp)
assert result.index.names == exp.index.names

def test_concat_multiple_append(self):
#  GH 29699
df = pd.DataFrame({"col1": [1, 2, 3], "col2": [11, 12, 13]})
df = pd.concat([df], keys=["multi"], names=["level1"], axis=1, sort=False)

# catch warning from not specifying sort
for i in range(10):
df[i, "colA"] = 10
a = pd.DataFrame({"col1": [1, 2, 3], "col2": [11, 12, 13]})
a = pd.concat([a], keys=["multi"], names=["level1"], axis=1, sort=False)
df = df.append(a, ignore_index=True)

result = df["multi"]
expected = pd.DataFrame({"col1": [1, 2, 3] * 11, "col2": [11, 12, 13] * 11})
tm.assert_frame_equal(result, expected)

def test_crossed_dtypes_weird_corner(self):
columns = ["A", "B", "C", "D"]
df1 = DataFrame(
Expand Down