Skip to content

BUG: concat of bool and boolean giving object dtype #43409

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

Merged
merged 5 commits into from
Sep 7, 2021

Conversation

mzeitlin11
Copy link
Member

@mzeitlin11 mzeitlin11 added Bug Dtype Conversions Unexpected or buggy dtype conversions NA - MaskedArrays Related to pd.NA and nullable extension arrays Reshaping Concat, Merge/Join, Stack/Unstack, Explode labels Sep 4, 2021
@jreback jreback added this to the 1.4 milestone Sep 5, 2021
@@ -597,6 +597,15 @@ def test_concat_preserves_extension_int64_dtype():
tm.assert_frame_equal(result, expected)


def test_concat_bool_boolean():
Copy link
Contributor

Choose a reason for hiding this comment

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

can you parameterize and also include a bool series here as a test (e.g. no boolean, just plain bool)

Copy link
Member Author

Choose a reason for hiding this comment

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

Have added other combinations

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm. comment for possible followup

# Handle only boolean + np.bool_ -> boolean, since other cases like
# Int64 + boolean -> Int64 will be handled by the other type
if all(
isinstance(t, BooleanDtype)
Copy link
Contributor

Choose a reason for hiding this comment

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

is_bool_dtype should work here no?

that said i think we are using mostly this type of pattern, which i am actually not much of a fan of. so ok for this PR. but we should ideally be using the common accessors rather than writing new ones for EA types, can you open an issue about this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, will do

@jreback jreback merged commit 8578696 into pandas-dev:master Sep 7, 2021
@mzeitlin11 mzeitlin11 deleted the boolean_concat branch September 7, 2021 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Dtype Conversions Unexpected or buggy dtype conversions NA - MaskedArrays Related to pd.NA and nullable extension arrays Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: concat behaves differently for bool/boolean dtypes than it does for int64/Int64
2 participants