-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: concat of Series of EA and other dtype fails #20840
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,8 +175,8 @@ def is_nonempty(x): | |
return _concat_sparse(to_concat, axis=axis, typs=typs) | ||
|
||
extensions = [is_extension_array_dtype(x) for x in to_concat] | ||
if any(extensions): | ||
to_concat = [np.atleast_2d(x.astype('object')) for x in to_concat] | ||
if any(extensions) and axis == 1: | ||
to_concat = [np.atleast_2d(x.astype('object')) for x in to_concat] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason you added this extra indent? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope, sorry that was from a previous iteration where I had a second |
||
|
||
if not nonempty: | ||
# we have all empties, but may need to coerce the result dtype to | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,11 @@ def test_concat_mixed_dtypes(self, data): | |
expected = pd.concat([df1.astype('object'), df2.astype('object')]) | ||
self.assert_frame_equal(result, expected) | ||
|
||
result = pd.concat([df1['A'], df2['A']]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this just for axis=1? I would make this a separate test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bug is just with For Though I don't see any tests for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, thought we already had some, but indeed, apparently not. Will add some. |
||
expected = pd.concat([df1['A'].astype('object'), | ||
df2['A'].astype('object')]) | ||
self.assert_series_equal(result, expected) | ||
|
||
def test_align(self, data, na_value): | ||
a = data[:3] | ||
b = data[2:5] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so what happens on axis=0? coerced to
object
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right (everything is upcast).