Skip to content

BUG: Series add casting to object for list and masked series #50762

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 3 commits into from
Jan 17, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Jan 15, 2023

if not hasattr(other, "dtype") and is_list_like(other):
# Try inferring masked dtype instead of casting to object
inferred_dtype = lib.infer_dtype(other, skipna=True)
if inferred_dtype == "integer":
Copy link
Member

Choose a reason for hiding this comment

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

How about boolean?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, adjusted

Copy link
Member

Choose a reason for hiding this comment

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

any particular reason not to call pd.array here?

context: im looking at issues relating to infer_dtype and trying to track down how many of our usages we really need

@mroeschke mroeschke added Numeric Operations Arithmetic, Comparison, and Logical operations NA - MaskedArrays Related to pd.NA and nullable extension arrays labels Jan 16, 2023
@mroeschke mroeschke added this to the 2.0 milestone Jan 17, 2023
@mroeschke mroeschke merged commit f63e7b8 into pandas-dev:main Jan 17, 2023
@mroeschke
Copy link
Member

Thanks @phofl

@phofl phofl deleted the 22962 branch January 17, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NA - MaskedArrays Related to pd.NA and nullable extension arrays Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IntegerArray + List returns ndarray
3 participants