diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index 1bc548de91f01..0d75cf21b56f5 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -413,6 +413,10 @@ def __init__( copy: bool = True, sort: bool = False, ) -> None: + for i in range(len(objs)): + if isinstance(objs[i], ABCSeries): + objs[i] = objs[i].to_frame() + if isinstance(objs, (ABCSeries, ABCDataFrame, str)): raise TypeError( "first argument must be an iterable of pandas " diff --git a/pandas/tests/reshape/concat/test_concat.py b/pandas/tests/reshape/concat/test_concat.py index ea0d510d2b8f8..80fa81f1d9ab6 100644 --- a/pandas/tests/reshape/concat/test_concat.py +++ b/pandas/tests/reshape/concat/test_concat.py @@ -883,3 +883,10 @@ def test_concat_none_with_timezone_timestamp(): result = concat([df1, df2], ignore_index=True) expected = DataFrame({"A": [None, pd.Timestamp("1990-12-20 00:00:00+00:00")]}) tm.assert_frame_equal(result, expected) + +def test_concat_dataframe_and_series(): + df1 = DataFrame({'A': [1, 2], 'B': [3, 4]}) + s1 = Series([1, 2], name='A') + result = pd.concat([df1, s1]) + expected_result = pd.concat([df1, s1.to_frame()]) + assert result.equals(expected_result)