class_docstr: Index subclass for indexes backed by ExtensionArray.
class_docstr_tok: ["Index","subclass","for","indexes","backed","by","ExtensionArray","."]
code: def map(self, mapper, na_action=None):
      # Try to run function on index first, and then on elements of index
      # Especially important for group-by functionality
      try:
          result = mapper(self)
  
          # Try to use this result if we can
          if isinstance(result, np.ndarray):
              result = Index(result)
  
          if not isinstance(result, Index):
              raise TypeError(
                  "The map function must return an Index object"
              )
          return result
      except Exception:
          return self.astype(object).map(mapper)
  
file_path: catboost/contrib/python/pandas/py3/pandas/core/indexes/extension.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable, TypeVar
  import numpy
  from pandas._typing import ArrayLike, npt
  from pandas.util._decorators import cache_readonly, doc
  from pandas.core.dtypes.generic import ABCDataFrame
  from pandas.core.indexes.base import Index
label_desc: Use image node_id 2 for calling the ExtensionIndex obj's underlying member method code with example usage: obj.map(mapper, na_action) and returns: result, self