Skip to content

BUG: Fixed bug where Series.append raised TypeError with tuple of Series #28416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.25.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Other
^^^^^

- Compatibility with Python 3.8 in :meth:`DataFrame.query` (:issue:`27261`)
-
- Bug in :meth:`Series.append` where it raised TypeError if tuple of series was passed in 'to_append' param. (:issue:`28410`)

.. _whatsnew_0.252.contributors:

Expand Down
4 changes: 3 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2729,8 +2729,10 @@ def append(self, to_append, ignore_index=False, verify_integrity=False):
"""
from pandas.core.reshape.concat import concat

if isinstance(to_append, (list, tuple)):
if isinstance(to_append, list):
to_concat = [self] + to_append
elif isinstance(to_append, tuple):
to_concat = [self] + list(to_append)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could just do this on line 2733

else:
to_concat = [self, to_append]
return concat(
Expand Down