-
-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
ENH: add na_action to Categorical.map & CategoricalIndex.map #51645
ENH: add na_action to Categorical.map & CategoricalIndex.map #51645
Conversation
5674674
to
10f8606
Compare
6b461b2
to
64b7297
Compare
I've updated again. I noticed that the implicit default for So I've set the default value of |
7775e2b
to
dc60e20
Compare
1f19c3e
to
dc9d119
Compare
I’ve simplified the implementation. |
1fc89b7
to
be2d451
Compare
Ping. |
pandas/core/apply.py
Outdated
mapped = obj._map_values(mapper=f, convert=self.convert_dtype) | ||
# apply doesn't have a `na_action` keyword and for backward compat reasons | ||
# we need to give `na_action="ignore"` for categorical data. | ||
# TODO: remove the `na_action="ignore"` has been removed from Categorical. |
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 supposed to refer to once the deprecation is enforced?
pandas/core/arrays/categorical.py
Outdated
|
||
.. deprecated:: 2.1.0 | ||
|
||
The dault value of 'ignore' has been deprecated and will be changed to |
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.
The dault value of 'ignore' has been deprecated and will be changed to | |
The default value of 'ignore' has been deprecated and will be changed to |
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.
The logic looks a lot simpler thanks. Kinda unfortunate that user will automatically get a deprecation warning, but i think this is okay as map
is a fairly uncommon method
Thanks @topper-123 |
…dev#51645) * ENH: add na_action to Categorical.map * add GH numbers * pre-commit issues * map Categorical with Series * REF: simplify .map * pass test_map * fix whatsnew * cleanups * pre-commit * deprecate Categorical.map(na_action=ignore) * fix docstrings * fix rebase * simplity implementation * fix warn * fix comments
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.