Option to Raise Exception on Unmapped Value in Series.map
See original GitHub issueAdd a flag (or extend na_action
) to raise an exception in Series.map
if a value is not successfully mapped (ie in the case where arg
is a dict.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Ignoring Unmapped Properties with MapStruct - Baeldung
In order to ignore unmapped properties and get no output warnings, we should assign the IGNORE value to the unmappedTargetPolicy. There are ...
Read more >Jackson exception handling - How to get all unmapped fields
You should rely on validation to respond to such case. First, add the dependency (I assume you use spring boot)
Read more >pandas.Series.map — pandas 1.5.2 documentation
Map values of Series according to an input mapping or function. Used for substituting each value in a Series with another value, that...
Read more >Sequence Alignment/Map Format Specification - Samtools
SAM stands for Sequence Alignment/Map format. It is a TAB-delimited text format consisting of a header section, which is optional, ...
Read more >MapStruct 1.5.3.Final Reference Guide
Supported values are: ERROR : any unmapped source property will cause the mapping code generation to fail. WARN : any unmapped ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If I were do this:
my return type is of
int64
and everything is mapped. However for this:my return type is
floatX
and there is a nan. Instead this is a “mistake” and I would have preferred an exception to be raised.I could assert that the type is int (brittle and just works for ints) or perhaps check all of the unique values in advance to make sure they are a subset of the mapping
arg
keys (require another pass over data).Quite the 6-year necroraise, but little bump that would be really useful to have an
na_action="raise"
onSeries.map
A workaround for the moment is to (re)define
__missing__
to raise, i.e.