np.inf, np.nan, pd.NA in array. The possibilities are: - True: Force all values of array to be finite. - False: accepts np.inf, np.nan, pd.NA in array. - 'allow-nan': accepts only np.nan and pd.NA values in array. Values cannot be infinite. .. versionadded:: 0.20 ``force_all_finite`` accepts the string ``'allow-nan'``. .. versionchanged:: 0.23 Accepts `pd.NA` and converts it into `np.nan` .. deprecated:: 1.6 `force_all_finite` was renamed to `ensure_all_finite` and will be removed in 1.8. ensure_all_finite : bool or 'allow-nan', default=True Whether to raise an error on np.inf, np.nan, pd.NA in array. The possibilities are: - True: Force all values of array to be finite. - False: accepts np.inf, np.nan, pd.NA in array. - 'allow-nan': accepts only np.nan and pd.NA values in array. Values cannot be infinite. .. versionadded:: 1.6 `force_all_finite` was renamed to `ensure_all_finite`. ensure_non_negative : bool, default=False Make sure the array has only non-negative values. If True, an array that contains negative values will raise a ValueError. .. versionadded:: 1.6 ensure_2d : bool, default=True Whether to raise a value error if array is not 2D. allow_nd : bool, default=False Whether to allow array.ndim > 2. ensure_min_samples : int, default=1 Make sure that the array has a minimum number of samples in its first axis (rows for a 2D array). Setting to 0 disables this check. ensure_min_features : int, default=1 Make sure that the 2D array has some minimum number of features (columns). The default value of 1 rejects empty datasets. This check is only enforced when the input data has effectively 2 dimensions or is originally 1D and ``ensure_2d`` is True. Setting to 0 disables this check. estimator : str or estimator instance, default=None If passed, include the name of the estimator in warning messages. 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. .. versionadded:: 1.1.0 Returns ------- array_converted : object The converted and validated array. Examples -------- >>> from sklearn.utils.validation import check_array >>> X = [[1, 2, 3], [4, 5, 6]] >>> X_checked = check_array(X) >>> X_checked array([[1, 2, 3], [4, 5, 6]]) z©np.matrix is not supported. Please convert to a numpy array with np.asarray. For more information see: https://numpy.org/doc/stable/reference/generated/numpy.matrix.htmlrú