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
CLN: enforce deprecation of the Series[categorical].replace special-casing #58270
base: main
Are you sure you want to change the base?
CLN: enforce deprecation of the Series[categorical].replace special-casing #58270
Conversation
pandas/core/arrays/categorical.py
Outdated
@@ -2680,15 +2680,9 @@ def _replace(self, *, to_replace, value, inplace: bool = False) -> Self | None: | |||
NDArrayBacked.__init__(cat, new_codes, new_dtype) | |||
|
|||
if new_dtype != orig_dtype: | |||
warnings.warn( | |||
# GH#55147 | |||
raise TypeError( |
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.
is this method called anywhere? i think it can just be removed
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.
there is special-casing in internals.blocks that calls this method. that special-casing needs to be removed
xref #56385
enforced deprecation of the behavior of
DataFrame.replace
andSeries.replace
withCategoricalDtype