Debug the "NaN" error of sklearn using pandas dataframe input
<p>I read my input as pandas dataframe and filled NaN by:</p>

<pre><code>df = df.fillna(0)
</code></pre>

<p>After that I split into train and test set and do a classification using sklearn.</p>

<pre><code>features = df.drop('class',axis=1)
labels = df['class']
features_train, features_test, labels_train, labels_test = train_test_split(features, labels, test_size=0.3, random_state=42)
clf.fit(features_train, labels_train)   
</code></pre>

<p>But I still got an "NaN error": ValueError: Input contains NaN, infinity or a value too large for dtype('float32'). It seems that fillna() didn't find the missing data. How can I find where the "NaN" is?</p>

<pre><code>df.isnull().sum()
</code></pre>

<p>that can show you if/where any NaN's exist inside the dataframe</p>

python pandas scikit-learn