From 845a52ad7253d571fc7715de0f56c8116e6767bc Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Thu, 12 Sep 2019 09:24:53 -0500 Subject: [PATCH 1/4] BUG: add failing test for GH28410 --- pandas/tests/series/test_combine_concat.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandas/tests/series/test_combine_concat.py b/pandas/tests/series/test_combine_concat.py index bf527bae297d9..5b77ef58b2ef8 100644 --- a/pandas/tests/series/test_combine_concat.py +++ b/pandas/tests/series/test_combine_concat.py @@ -54,6 +54,17 @@ def test_append_duplicates(self): with pytest.raises(ValueError, match=msg): pd.concat([s1, s2], verify_integrity=True) + def test_append_tuples(self): + # GH 28410 + s = pd.Series([1, 2, 3]) + list_input = [s, s] + tuple_input = (s, s) + + expected = s.append(list_input) + result = s.append(tuple_input) + + tm.assert_series_equal(expected, result) + def test_combine_scalar(self): # GH 21248 # Note - combine() with another Series is tested elsewhere because From ea8dce28373ef4d7e7e7d08d5eb88c8b2ed477f3 Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Thu, 12 Sep 2019 09:31:46 -0500 Subject: [PATCH 2/4] GH28410 fix Series.append raises TypeError with tuple of Series --- pandas/core/series.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 10d50e89ca92e..922977bc04d63 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2730,7 +2730,8 @@ def append(self, to_append, ignore_index=False, verify_integrity=False): from pandas.core.reshape.concat import concat if isinstance(to_append, (list, tuple)): - to_concat = [self] + to_append + to_concat = [self] + to_concat.extend(to_append) else: to_concat = [self, to_append] return concat( From d28192f80199b056f64816817f1f7b72738d6e06 Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Thu, 12 Sep 2019 09:39:24 -0500 Subject: [PATCH 3/4] added whatsnew entry --- doc/source/whatsnew/v1.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 71374a3bff692..f6ee9f31d568d 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -234,7 +234,7 @@ Other - Trying to set the ``display.precision``, ``display.max_rows`` or ``display.max_columns`` using :meth:`set_option` to anything but a ``None`` or a positive int will raise a ``ValueError`` (:issue:`23348`) - Using :meth:`DataFrame.replace` with overlapping keys in a nested dictionary will no longer raise, now matching the behavior of a flat dictionary (:issue:`27660`) - :meth:`DataFrame.to_csv` and :meth:`Series.to_csv` now support dicts as ``compression`` argument with key ``'method'`` being the compression method and others as additional compression options when the compression method is ``'zip'``. (:issue:`26023`) -- +- :meth:`Series.append` will no longer raise a type error when passed a tuple of ``Series`` .. _whatsnew_1000.contributors: From 3ff76977c4254410f1646a2a6b71224d023b21db Mon Sep 17 00:00:00 2001 From: Chris Zimmerman Date: Thu, 12 Sep 2019 12:19:07 -0500 Subject: [PATCH 4/4] Update doc/source/whatsnew/v1.0.0.rst Co-Authored-By: Tom Augspurger --- doc/source/whatsnew/v1.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index f6ee9f31d568d..5f46a815c65dc 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -234,7 +234,7 @@ Other - Trying to set the ``display.precision``, ``display.max_rows`` or ``display.max_columns`` using :meth:`set_option` to anything but a ``None`` or a positive int will raise a ``ValueError`` (:issue:`23348`) - Using :meth:`DataFrame.replace` with overlapping keys in a nested dictionary will no longer raise, now matching the behavior of a flat dictionary (:issue:`27660`) - :meth:`DataFrame.to_csv` and :meth:`Series.to_csv` now support dicts as ``compression`` argument with key ``'method'`` being the compression method and others as additional compression options when the compression method is ``'zip'``. (:issue:`26023`) -- :meth:`Series.append` will no longer raise a type error when passed a tuple of ``Series`` +- :meth:`Series.append` will no longer raise a ``TypeError`` when passed a tuple of ``Series`` (:issue:`28410`) .. _whatsnew_1000.contributors: