-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Inconsistent behavior of .replace() in Int64 series with NA #38693
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
Changes from 8 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
39ec797
pandas-dev issue #38267
ftrihardjo a83dbcb
pandas-dev issue #38267
ftrihardjo 3db04e7
pandas-dev issue #38267
ftrihardjo b8ccce5
pandas-dev issue #38267
ftrihardjo 9b3f075
pandas-dev issue #38267
ftrihardjo 9d437ec
pandas-dev issue #38267
ftrihardjo 76e2fa6
pandas-dev issue #38267
ftrihardjo 6320412
pandas-dev issue #38267
ftrihardjo a5dc3c4
pandas-dev issue #38267
ftrihardjo ced83a6
pandas-dev issue #38267
ftrihardjo d486750
pandas-dev issue #38267
ftrihardjo d11fddc
pandas-dev issue #38267
ftrihardjo 778392c
pandas-dev issue #38267
ftrihardjo 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 hidden or 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 |
---|---|---|
|
@@ -208,6 +208,13 @@ def test_replace_with_dict_with_bool_keys(self): | |
expected = pd.Series(["yes", False, "yes"]) | ||
tm.assert_series_equal(result, expected) | ||
|
||
@pytest.mark.parametrize("dtype", ["Int8", "Int16", "Int32", "Int64"]) | ||
def test_replace_Int_with_na(self, dtype): | ||
# GH 38267 | ||
result = pd.Series([0, None], dtype=dtype).replace(0, pd.NA) | ||
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 the working example as well e.g. 0,1 as another case. |
||
expected = pd.Series([pd.NA, pd.NA], dtype=dtype) | ||
tm.assert_series_equal(result, expected) | ||
|
||
def test_replace2(self): | ||
N = 100 | ||
ser = pd.Series(np.fabs(np.random.randn(N)), tm.makeDateIndex(N), dtype=object) | ||
|
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.
can you use the fixture: any_nullable_int_dtype instead here.