code: def check_endog(
      y,
      dtype=DTYPE,
      copy=True,
      force_all_finite=False,
      preserve_series=True,
  ):
      """Wrapper for ``check_array`` and ``column_or_1d`` from sklearn
  
      Parameters
      ----------
      y : array-like, shape=(n_samples,)
          The 1d endogenous array.
  
      dtype : string, type or None (default=np.float64)
          Data type of result. If None, the dtype of the input is preserved.
          If "numeric", dtype is preserved unless array.dtype is object.
  
      copy : bool, optional (default=False)
          Whether a forced copy will be triggered. If copy=False, a copy might
          still be triggered by a conversion.
  
      force_all_finite : bool, optional (default=False)
          Whether to raise an error on np.inf and np.nan in an array. The
          possibilities are:
  
          - True: Force all values of array to be finite.
          - False: accept both np.inf and np.nan in array.
  
      preserve_series : bool, optional
          Whether to preserve a ``pd.Series`` object. Will also attempt to
          squeeze a dataframe into a ``pd.Series``.
  
      Returns
      -------
      y : np.ndarray or pd.Series, shape=(n_samples,)
          A 1d numpy ndarray
      """
      endog = skval.check_array(
          y,
          ensure_2d=False,
          force_all_finite=force_all_finite,
          copy=copy,
          dtype=dtype,
      )
  
      endog = skval.column_or_1d(endog)
      if not preserve_series:
          return endog
  
      # possibly restore index information, if it was present, assigning
      # checked/casted values back into the series
      if isinstance(y, pd.DataFrame):
          y = y.squeeze()  # dtype: pd.Series
  
      if isinstance(y, pd.Series):
          endog = pd.Series(endog, index=y.index)
      return endog
  
file_path: pmdarima/pmdarima/utils/array.py
imports: from sklearn.utils import validation
  import numpy
  import pandas
  from ..compat import DTYPE
  from ._array import C_intgrt_vec
label_desc: Use image node_id 3 for calling a global function with example usage: check_endog(y, dtype, copy, force_all_finite, preserve_series) and returns: endog, endog