Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils`.assert_all_finite

sklearn.utils.assert_all_finite(X, *, allow_nan=False, estimator_name=None, input_name='')

  Throw a ValueError if X contains NaN or infinity.

  Parameters:
    X{ndarray, sparse matrix}

      The input data.

    allow_nan bool, default=False

      If True, do not throw error when `X` contains NaN.

    estimator_name str, default=None

      The estimator name, used to construct the error message.

    input_name str, default=””

      The data name used to construct the error message. In particular if `input_name` is “X” and the data has NaN values and allow_nan is False, the error message will link to the imputer documentation.