Skip to content
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

BUG: Creation of UInt64 column with 18446744073709551615 throws RuntimeWarning #60214

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

lfffkh
Copy link

@lfffkh lfffkh commented Nov 6, 2024

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Please always add tests when fixing bugs or changing behavior.

pandas/core/construction.py Outdated Show resolved Hide resolved
@rhshadrach rhshadrach added Bug Constructors Series/DataFrame/Index/pd.array Constructors labels Nov 6, 2024
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Can you add a test for DataFrame/Series construction as well.

data.soften_mask() # set hardmask False if it was True
data[mask] = fill_value
dtype = cast(np.dtype, data.dtype)
if isinstance(dtype, ExtensionDtype) and dtype.name.startswith("Masked"):
Copy link
Member

Choose a reason for hiding this comment

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

I haven't checked thoroughly, but I think you want dtype._can_hold_na instead of having logic depend on the name of the dtype.

),
],
)
def test_sanitize_masked_array_with_masked_ea(values, dtype, expected):
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a case that tests for a large number as in an issue.

Also start the test with a reference to the GitHub issue:

# GH#60050

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Constructors Series/DataFrame/Index/pd.array Constructors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants