-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
lfffkh
wants to merge
16
commits into
pandas-dev:main
Choose a base branch
from
lfffkh:bug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8340f09
first
lfffkh c4fb9dc
fix bug
lfffkh 650d6f8
Merge branch 'main' into bug
lfffkh 3d6abaa
fix bug2
lfffkh c51cb6a
Merge branch 'main' into bug
lfffkh f1ab71a
Merge branch 'main' into bug
lfffkh e9ae377
add test
lfffkh 2965213
Merge branch 'main' into bug
lfffkh 8838773
add test2
lfffkh 8ab31ad
Merge branch 'main' into bug
lfffkh a8604fa
Merge branch 'bug' of https://github.com/lfffkh/pandas into bug
lfffkh 3777b47
Merge branch 'main' into bug
lfffkh 1f72bc3
add test3
lfffkh 65dc879
Merge branch 'bug' of https://github.com/lfffkh/pandas into bug
lfffkh d78be3b
add test4
lfffkh 7521f65
add test5
lfffkh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,38 @@ def test_construct_1d_ndarray_preserving_na_datetimelike(dtype): | |
|
||
result = sanitize_array(arr, index=None, dtype=np.dtype(object)) | ||
tm.assert_numpy_array_equal(result, expected) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"values, dtype, expected", | ||
[ | ||
( | ||
np.ma.masked_array([1, 2, 3], mask=[False, True, False]), | ||
"int64", | ||
np.array([1, 2, 3], dtype=np.int64), | ||
), | ||
( | ||
np.ma.masked_array([1, 2, 3], mask=[False, True, False]), | ||
"float64", | ||
np.array([1, 2, 3], dtype=np.float64), | ||
), | ||
( | ||
np.ma.masked_array([1, 2, 3], mask=[False, True, False]), | ||
"UInt64", | ||
np.array([1, 2, 3], dtype=np.uint64), | ||
), | ||
( | ||
np.ma.masked_array([1.0, 2.0, 3.0], mask=[False, True, False]), | ||
"float64", | ||
np.array([1.0, 2.0, 3.0], dtype=np.float64), | ||
), | ||
( | ||
np.ma.masked_array([1.0, 2.0, 3.0], mask=[False, True, False]), | ||
"Int64", | ||
np.array([1, 2, 3], dtype=np.int64), | ||
), | ||
], | ||
) | ||
def test_sanitize_masked_array_with_masked_ea(values, dtype, expected): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
|
||
result = sanitize_array(values, index=None, dtype=dtype) | ||
tm.assert_masked_array_equal(result, expected) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.