I am getting this error from scikit-learn:
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
Which is a results from this check here. Based on this post, I can use df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)
because I want to detect any nan
or inf
values and then removing the row containing any one of them. However, I use Python 3.6 so the error says:
AttributeError: 'NoneType' object has no attribute 'dropna'
How can I modify df.replace([np.inf, -np.inf], np.nan).dropna(axis=1)
so that I can detect a row containing inf
or nan
and then remove it?