在调用np.isnan的时候遇到了如下异常:
ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
主要问题在于np.isnan的参数np.array不能是object type的。
所以在调用np.isnan的时候一定要注意其参数的dtype为np.float32 等类似数值对象。
tmp = np.array([1,2,3], dtype=np.float32)
np.isnan(tmp)
这样异常就会消失。