What does Series.map(func, na_action='ignore') change compared with the default behaviour?
Correct answer
B. NaN entries pass through untouched instead of being sent to the function
16 views
B. NaN entries pass through untouched instead of being sent to the function
16 views
By default map calls the function on every entry, including NaN, which is why a function that cannot handle missing values fails; na_action='ignore' skips those entries and leaves them as NaN. The option applies to a callable, not to a dict mapping, where a missing key already becomes NaN. Use fillna or a mapping with an explicit default to control the replacement.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is B? Ask here and get an explanation.