Skip to content

BUG: Refactor construction process for MaskedArrays in series constructors #58900

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

Conversation

giormala
Copy link
Contributor

@giormala giormala commented Jun 2, 2024

Comment on lines +522 to +526
if not mask.all():
idx = np.unravel_index(np.nanargmax(data, axis=None), data.shape)
if not mask[idx] and int(data[idx]) != original[idx]:
if is_integer_dtype(original_dtype) and is_float_dtype(data.dtype):
data = ma.asarray(original, "object")
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if this is the appropriate solution. Converting to object should be avoided

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please expand on your idea? What could I use instead of an object? Thanks for your help!

Copy link
Member

Choose a reason for hiding this comment

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

I imagine the dtype output from maybe_promote isn't entirely appropriate given the original issue. Casting to object would cover up the root issue. This issue I suspect is fairly non-trivial.

@giormala giormala closed this Jun 11, 2024
@giormala giormala deleted the fix-56566 branch June 11, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Inconsistent behavior while constructing a Series with large integers in a int64 masked array
2 participants