-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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: Allow s.map(d, na_action='raise')
#60482
base: main
Are you sure you want to change the base?
Conversation
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
756b49f
to
5efce7b
Compare
map_array(na_action='raise')
s.map(d, na_action='raise')
s.map(d, na_action='raise')
s.map(d, na_action='raise')
Still interested! |
Sorry for pinging @mroeschke - can you please spend a quick glimpse on that, if the design and the goal is worth following ... thank you in advance! |
Addresses #14210
Often users use
s.map()
blindly (without checking the original series beforehand due to their expectations) and are surprised by downstream errors which are caused by the implicit replacement of values tonp.nan
if they are not part of the mapping dictionary:This example here also shows how a typo in the input data can cause unwanted trouble.
This PR adds a possibility to raise an error via
s.map(d, na_option='raise')
, if the mapping does not cover all values in the array.doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.