code: def to_numpy(po: pd.DataFrame) -> np.ndarray:
      """
      Workaround legacy pandas lacking to_numpy
  
      Parameters
      ----------
      po : Pandas obkect
  
      Returns
      -------
      ndarray
          A numpy array
      """
      try:
          return po.to_numpy()
      except AttributeError:
          return po.values
  
file_path: statsmodels/statsmodels/compat/pandas.py
imports: from typing import Optional
  import numpy
  from packaging.version import Version, parse
  import pandas
  from pandas.util._decorators import Appender, Substitution, cache_readonly, deprecate_kwarg
label_desc: Use image node_id 3 for calling a global function with example usage: to_numpy(po) and returns: po, po