diff --git a/pandas/core/series.py b/pandas/core/series.py index 33565bbedade6..2076d83248861 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2462,7 +2462,7 @@ def searchsorted(self, value, side="left", sorter=None): # ------------------------------------------------------------------- # Combination - def append(self, to_append, ignore_index=False, verify_integrity=False) -> "Series": + def append(self, to_append, ignore_index=False, verify_integrity=False): """ Concatenate two or more Series. @@ -2539,10 +2539,8 @@ def append(self, to_append, ignore_index=False, verify_integrity=False) -> "Seri to_concat.extend(to_append) else: to_concat = [self, to_append] - return self._ensure_type( - concat( - to_concat, ignore_index=ignore_index, verify_integrity=verify_integrity - ) + return concat( + to_concat, ignore_index=ignore_index, verify_integrity=verify_integrity ) def _binop(self, other, func, level=None, fill_value=None): 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):