def _map_values(self, mapper, na_action=None):
<EOL>if isinstance(mapper, dict):<EOL><INDENT>if hasattr(mapper, '<STR_LIT>'):<EOL><INDENT>dict_with_default = mapper<EOL>mapper = lambda x: dict_with_default[x]<EOL><DEDENT>else:<EOL><INDENT>from pandas import Series<EOL>mapper = Series(mapper)<EOL><DEDENT><DEDENT>if isinstance(mapper, ABCSeries):<EOL><INDENT>if is_extension_type(self.dtype):<EOL><INDENT>values = self._values<EOL><DEDENT>else:<EOL><INDENT>values = self.values<EOL><DEDENT>indexer = mapper.index.get_indexer(values)<EOL>new_values = algorithms.take_1d(mapper._values, indexer)<EOL>return new_values<EOL><DEDENT>if is_extension_type(self.dtype):<EOL><INDENT>values = self._values<EOL>if na_action is not None:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>map_f = lambda values, f: values.map(f)<EOL><DEDENT>else:<EOL><INDENT>values = self.astype(object)<EOL>values = getattr(values, '<STR_LIT>', values)<EOL>if na_action == '<STR_LIT:ignore>':<EOL><INDENT>def map_f(values, f):<EOL><INDENT>return lib.map_infer_mask(values, f,<EOL>isna(values).view(np.uint8))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>map_f = lib.map_infer<EOL><DEDENT><DEDENT>new_values = map_f(values, mapper)<EOL>return new_values<EOL>
An internal function that maps values using the input
correspondence (which can be a dict, Series, or function).

Parameters
----------
mapper : function, dict, or Series
    The input correspondence object
na_action : {None, 'ignore'}
    If 'ignore', propagate NA values, without passing them to the
    mapping function

Returns
-------
Union[Index, MultiIndex], inferred
    The output of the mapping function applied to the index.
    If the function returns a tuple with more than one element
    a MultiIndex will be returned.