Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils.validation`.column_or_1d

sklearn.utils.validation.column_or_1d(y, *, dtype=None, warn=False)

  Ravel column or 1d numpy array, else raises an error.

  Parameters:
    y array-like

      Input data.

    dtype data-type, default=None

      Data type for `y`.

      New in version 1.2.

    warn bool, default=False

      To control display of warnings.

  Returns:
    y ndarray

      Output data.

  Raises:
    ValueError

      If `y` is not a 1D array or a 2D array with a single row or column.