Skip to content

ENH: maybe_convert_objects add boolean support with NA #50047

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

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 3, 2022

This is necessary for read_sql and nullables.

I could not find a usage of convert_to_nullable_integer, so we should be able to repurpose the keyword

@phofl phofl added Enhancement Dtype Conversions Unexpected or buggy dtype conversions labels Dec 3, 2022
encountered, whether to convert and return an IntegerArray.
convert_to_nullable_dtype : bool, default False
If an array-like object contains only integer or boolean values (and NaN) is
encountered, whether to convert and return an Boolean/IntegerArray.
Copy link
Member

Choose a reason for hiding this comment

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

Just to confirm FloatArray isn't supported yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is something I raised in the sql pr as well. Currently, we only use ea, when the regular dtype can’t hold missing values. So there is no real use case for FloatArray.

it would probably make more sense to always convert when this flag is set, but this is out of scope here

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. I would opt to returning Float64 when people specify use_nullable_dtypes=True, especially once (hopefully) other core devs find it useful to store NaN & NA

But sure can be a follow up

@mroeschke mroeschke added this to the 2.0 milestone Dec 8, 2022
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

LGTM merge when ready @jbrockmendel

@jbrockmendel jbrockmendel merged commit 4901410 into pandas-dev:main Dec 9, 2022
@jbrockmendel
Copy link
Member

thanks @phofl

@phofl phofl deleted the maybe_convert_objects_nullable_boolean branch December 9, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants