ValueError:输入包含 NaN、无穷大或对于 dtype('float32') 来说太大的值。有什么建议吗?

数据挖掘 Python 主成分分析 验证
2022-02-14 12:21:35

尝试组装 PCA 时出现以下错误。

我的代码:

  is_float = X.dtype.kind in 'fc'
    if is_float and (np.isfinite(_safe_accumulator_op(np.sum, X))):
        pass
    elif is_float:
        msg_err = "Input contains {} or a value too large for {!r}."
        if (allow_nan and np.isinf(X).any() or
                not allow_nan and not np.isfinite(X).all()):
            type_err = 'infinity' if allow_nan else 'NaN, infinity'
            raise ValueError(
                    msg_err.format
                    (type_err,
                     msg_dtype if msg_dtype is not None else X.dtype)
            )

错误:

ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

任何帮助或建议将不胜感激!

谢谢!

0个回答
没有发现任何回复~