class_docstr: Mixin class with utilities for by-column applicates.
docstr: Coerce obj to pandas Index, replacing ints by index elements.
  
  Parameters
  ----------
  obj : iterable of pandas compatible index elements or int
  ref : reference index, coercible to pd.Index, optional, default=None
  
  Returns
  -------
  obj coerced to pd.Index
      if ref was passed, and
      if obj had int or np.integer elements which do not occur in ref,
      then each int-like element is replaced by the i-th element of ref
docstr_tok: ["Coerce","obj","to","pandas","Index",",","replacing","ints","by","index","elements",".","Parameters","--","--","--","--","--","obj",":","iterable","of","pandas","compatible","index","elements","or","int","ref",":","reference","index",",","coercible","to","pd.Index",",","optional",",","default=None","Returns","--","--","--","-","obj","coerced","to","pd.Index","if","ref","was","passed",",","and","if","obj","had","int","or","np.integer","elements","which","do","not","occur","in","ref",",","then","each","int-like","element","is","replaced","by","the","i-th","element","of","ref"]
code: def _coerce_to_pd_index(self, obj, ref=None):
      """Coerce obj to pandas Index, replacing ints by index elements.
  
      Parameters
      ----------
      obj : iterable of pandas compatible index elements or int
      ref : reference index, coercible to pd.Index, optional, default=None
  
      Returns
      -------
      obj coerced to pd.Index
          if ref was passed, and
          if obj had int or np.integer elements which do not occur in ref,
          then each int-like element is replaced by the i-th element of ref
      """
      if ref is not None:
          # coerce ref to pd.Index
          if not isinstance(ref, pd.Index):
              if hasattr(ref, "columns") and isinstance(
                  ref.index, pd.Index
              ):
                  ref = ref.columns
          else:
              ref = pd.Index(ref)
  
          # replace ints by column names
          obj = self._get_indices(ref, obj)
  
      # deal with numpy int by coercing to python int
      if np.issubdtype(type(obj), np.integer):
          obj = int(obj)
  
      # coerce to pd.Index
      if isinstance(obj, (int, str)):
          return pd.Index([obj])
      else:
          return pd.Index(obj)
  
imports: from inspect import isclass
  import numpy
  import pandas
  from sktime.base import BaseEstimator
label_desc: Use image node_id 1 for calling the _ColumnEstimator obj's underlying member method code with example usage: obj._coerce_to_pd_index(obj, ref) and returns: pd, pd