code: def _wrap_in_pandas_container(
      data_to_wrap,
      *,
      columns,
      index=None,
  ):
      """Create a Pandas DataFrame.
  
      If `data_to_wrap` is a DataFrame, then the `columns` and `index` will be changed
      inplace. If `data_to_wrap` is a ndarray, then a new DataFrame is created with
      `columns` and `index`.
  
      Parameters
      ----------
      data_to_wrap : {ndarray, dataframe}
          Data to be wrapped as pandas dataframe.
  
      columns : callable, ndarray, or None
          The column names or a callable that returns the column names. The
          callable is useful if the column names require some computation.
          If `columns` is a callable that raises an error, `columns` will have
          the same semantics as `None`. If `None` and `data_to_wrap` is already a
          dataframe, then the column names are not changed. If `None` and
          `data_to_wrap` is **not** a dataframe, then columns are
          `range(n_features)`.
  
      index : array-like, default=None
          Index for data. `index` is ignored if `data_to_wrap` is already a DataFrame.
  
      Returns
      -------
      dataframe : DataFrame
          Container with column names or unchanged `output`.
      """
      if issparse(data_to_wrap):
          raise ValueError(
              "Pandas output does not support sparse data."
          )
  
      if callable(columns):
          try:
              columns = columns()
          except Exception:
              columns = None
  
      pd = check_pandas_support("Setting output container to 'pandas'")
  
      if isinstance(data_to_wrap, pd.DataFrame):
          if columns is not None:
              data_to_wrap.columns = columns
          return data_to_wrap
  
      return pd.DataFrame(
          data_to_wrap, index=index, columns=columns, copy=False
      )
  
file_path: catboost/contrib/python/scikit-learn/py3/sklearn/utils/_set_output.py
imports: from functools import wraps
  from scipy.sparse import issparse
  from .._config import get_config
  from .None import check_pandas_support
  from ._available_if import available_if
label_desc: Use image node_id 1 for calling a global function with example usage: _wrap_in_pandas_container(data_to_wrap) and returns: pd, data_to_wrap