def _ensure_2d(x, ndarray=False):
 if (x is None):
  return x
 is_pandas = _is_using_pandas(x, None)
 if (x.ndim == 2):
  if is_pandas:
   return (x, x.columns)
  else:
   return (x, None)
 elif (x.ndim > 2):
  raise ValueError('x mst be 1 or 2-dimensional.')
 name = (x.name if is_pandas else None)
 if ndarray:
  return (np.asarray(x)[:, None], name)
 else:
  return (pd.DataFrame(x), name)

def _ensure_2d ( x , ndarray = False ) : if ( x is None ) : return x is_pandas = _is_using_pandas ( x , None ) if ( x . ndim == 2 ) : if is_pandas : return ( x , x . columns ) else : return ( x , None ) elif ( x . ndim > 2 ) : raise ValueError ( 'x mst be 1 or 2-dimensional.' ) name = ( x . name if is_pandas else None ) if ndarray : return ( np . asarray ( x ) [ : , None ] , name ) else : return ( pd . DataFrame ( x ) , name )
parameters x : array .