-
-
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
Changes from 7 commits
39ec797
a83dbcb
3db04e7
b8ccce5
9b3f075
9d437ec
76e2fa6
6320412
a5dc3c4
ced83a6
d486750
d11fddc
778392c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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): | ||
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. should use 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. I'd call it |
||
# GH 38267 | ||
result = pd.Series([0, None]).astype(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. pass dtype directly to the Series constructor |
||
expected = pd.Series([pd.NA, 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. you also need to pass dtype here else (looking at CI output) this casts to object. That's why currently this test doesn't actually pass |
||
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) | ||
|
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.