Too big value for dtype ('float64')

I use numpy to read the arff file and I get the following error:

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

I used np.isnan(X2.any()) and np.isfinite(X2.all()) to check if this is a nan or an infinite case. But this is none of this. This means that this is the third case, which is infinity or a value too large for dtype('float64').

I would be grateful if someone would tell me how to take care of this error.

Thanks.

+5
source share
1 answer

OK I understood. After I used Imputer(missing_values='NaN', strategy='median', axis=1) imp.fit(X2) . I also had to write:

X2 = imp.fit_transform(X2) . The reason is because sklearn.preprocessing.Imputer.fit_transform returns a new array, it does not change the array of arguments

+7
source

Source: https://habr.com/ru/post/1215393/


All Articles