code: def _to_pandas(ob):
      
      if isinstance(ob, (pd.Series, pd.DataFrame)):
          return ob
  
      if ob.ndim == 1:
          return pd.Series(ob)
      elif ob.ndim == 2:
          return pd.DataFrame(ob)
      else:
          raise ValueError(
              'cannot convert array of dim > 2 to a pandas structure',
          )
docs: Convert an array-like to a pandas object.
  
      Parameters
      ----------
      ob : array-like
          The object to convert.
  
      Returns
      -------
      pandas_structure : pd.Series or pd.DataFrame
          The correct structure based on the dimensionality of the data.