Skip to content

Commit cf2e9b9

Browse files
meeseeksmachinehvardhan20
authored andcommitted
Backport PR #31036: BUG: AssertionError on Series.append(DataFrame) fix #30975 (#31267)
Co-authored-by: Harshavardhan Bachina <[email protected]>
1 parent cee2081 commit cf2e9b9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/series/methods/test_append.py

+10
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@ def test_append_tuples(self):
6161

6262
tm.assert_series_equal(expected, result)
6363

64+
def test_append_dataframe_regression(self):
65+
# GH 30975
66+
df = pd.DataFrame({"A": [1, 2]})
67+
result = df.A.append([df])
68+
expected = pd.DataFrame(
69+
{0: [1.0, 2.0, None, None], "A": [None, None, 1.0, 2.0]}, index=[0, 1, 0, 1]
70+
)
71+
72+
tm.assert_frame_equal(expected, result)
73+
6474

6575
class TestSeriesAppendWithDatetimeIndex:
6676
def test_append(self):

0 commit comments

Comments
 (0)