注意检查是否array中有nan值,如果有需要remove
remove方法:
array[~np.isnan(array)]
如在使用np.isnan()是出现:
TypeError: 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''
检查array中datatype是否为object,修改为需要的格式(比如float)
array([data], dtype=np.float)