I'm trying to run a Random Forest model from sklearn but I keep getting an error:
ValueError: Input contains NaN, infinity or a value too large for dtype('float32').
I tried following steps in ValueError: Input contains NaN, infinity or a value too large for dtype('float32')
fillna(0) on my pandas dataframe still gave the ValueError.
So I tried working with my numpy array:
val = setTo.ravel().nan_to_num(0)
But I keep getting an error:
'numpy.ndarray' object has no attribute 'nan_to_num'
I'm wondering how I can deal with the nan values if I have ndarray?
Thanks so much!
Thanks so much to @Beniamin H for all the help, as per suggested, I rescalled the data, which I based on https://stackoverflow.com/questions/34771118/sklearn-random-forest-error-on-input and it worked!