-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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-24971 copying blocks also considers ndim #25521
Changes from 2 commits
c482548
3cfd808
e22d67c
6c75e77
f7c9e3a
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 |
---|---|---|
|
@@ -280,3 +280,17 @@ def test_replace_mixed_types_with_string(self): | |
result = s.replace([2, '4'], np.nan) | ||
expected = pd.Series([1, np.nan, 3, np.nan, 4, 5]) | ||
tm.assert_series_equal(expected, result) | ||
|
||
@pytest.mark.parametrize("categorical, numeric", [ | ||
(pd.Categorical('A', categories=['A', 'B']), [1]), | ||
(pd.Categorical(('A', ), categories=['A', 'B']), [1]), | ||
(pd.Categorical(('A', 'B'), categories=['A', 'B']), [1, 2]), | ||
]) | ||
def test_copy_categorical_ndim(self, categorical, numeric): | ||
# GH 24971 | ||
s = pd.Series(categorical) | ||
result = s.replace({'A': 1, 'B': 2}) | ||
expected = pd.Series(numeric) | ||
print(result.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. can you remove the prints |
||
print(expected.dtype) | ||
tm.assert_series_equal(expected, result, check_dtype=False) | ||
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. this coerces? (I think we have another issue about this) can you find & reference it 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. Looks like L292 has the reference now (#23305) |
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.
name to to test_replace_categorical