Skip to content

Concatenation of series of differing types should lead to object #21922

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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ ExtensionType Changes
- Bug in :meth:`Series.get` for ``Series`` using ``ExtensionArray`` and integer index (:issue:`21257`)
- :meth:`Series.combine()` works correctly with :class:`~pandas.api.extensions.ExtensionArray` inside of :class:`Series` (:issue:`20825`)
- :meth:`Series.combine()` with scalar argument now works for any function type (:issue:`21248`)
- Bug in :func:`concat` that lead to inconsistent behaviour for ExtensionArrays where the scalar representation was int or float (:issue:`21792`)
-

.. _whatsnew_0240.api.incompatibilities:
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/dtypes/concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def is_nonempty(x):
extensions = [is_extension_array_dtype(x) for x in to_concat]
if any(extensions) and axis == 1:
to_concat = [np.atleast_2d(x.astype('object')) for x in to_concat]
elif any(extensions):
to_concat = [x.astype('object') for x in to_concat]

if not nonempty:
# we have all empties, but may need to coerce the result dtype to
Expand Down