code: def from_dataframe(df, allow_copy: bool = True) -> pd.DataFrame:
      """
      Build a ``pd.DataFrame`` from any DataFrame supporting the interchange protocol.
  
      Parameters
      ----------
      df : DataFrameXchg
          Object supporting the interchange protocol, i.e. `__dataframe__` method.
      allow_copy : bool, default: True
          Whether to allow copying the memory to perform the conversion
          (if false then zero-copy approach is requested).
  
      Returns
      -------
      pd.DataFrame
      """
      if isinstance(df, pd.DataFrame):
          return df
  
      if not hasattr(df, "__dataframe__"):
          raise ValueError("`df` does not support __dataframe__")
  
      return _from_dataframe(df.__dataframe__(allow_copy=allow_copy))
  
file_path: catboost/contrib/python/pandas/py3/pandas/core/interchange/from_dataframe.py
imports: from __future__ import annotations
  import ctypes
  import re
  from typing import Any
  import numpy
  from pandas.compat._optional import import_optional_dependency
  import pandas
  from pandas.core.interchange.dataframe_protocol import Buffer, Column, ColumnNullType, DataFrame, DtypeKind
  from pandas.core.interchange.utils import ArrowCTypes, Endianness
label_desc: Use image node_id 1 for calling a global function with example usage: from_dataframe(df, allow_copy) and returns: _from_dataframe, df