From 66f2aaa1b4ac5b71eabbc1369e55c95e25f08c82 Mon Sep 17 00:00:00 2001 From: Harshavardhan Bachina Date: Thu, 23 Jan 2020 21:37:32 -0600 Subject: [PATCH] Backport PR #31036: BUG: AssertionError on Series.append(DataFrame) fix #30975 --- pandas/tests/series/methods/test_append.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/tests/series/methods/test_append.py b/pandas/tests/series/methods/test_append.py index dc0fca4bba067..4d64b5b397981 100644 --- a/pandas/tests/series/methods/test_append.py +++ b/pandas/tests/series/methods/test_append.py @@ -61,6 +61,16 @@ def test_append_tuples(self): tm.assert_series_equal(expected, result) + def test_append_dataframe_regression(self): + # GH 30975 + df = pd.DataFrame({"A": [1, 2]}) + result = df.A.append([df]) + expected = pd.DataFrame( + {0: [1.0, 2.0, None, None], "A": [None, None, 1.0, 2.0]}, index=[0, 1, 0, 1] + ) + + tm.assert_frame_equal(expected, result) + class TestSeriesAppendWithDatetimeIndex: def test_append(self):