Drop null rows with dtype object from a DataFrame with Pandas
<p>I have a DataFrame that looks like this:</p>

<pre><code>Oper    ST  result
T2  9:24:09 NaN
T3  9:25:10 Fail
T4  9:25:36 Pass
T5  9:25:36 NaN
</code></pre>

<p>I want to drop the NaN rows from the 'result' column. All columns are dtype object:</p>

<pre><code>df.dtypes

Oper    object
ST      object
result  object
</code></pre>

<p>If I print the values and dytpes to a list they appear in this format:</p>

<pre><code>rlist = df['result'].tolist()
for r in rlist:    
    print(r,type(r))

-&gt; nan &lt;class 'float'&gt;
</code></pre>

<p>I tried these things unsuccessfully:</p>

<p>dropna:</p>

<pre><code>df.dropna(subset=['result'])
</code></pre>

<p>filtering:</p>

<pre><code>df = df[df['result'] != 'nan']
</code></pre>

<p>I also tried to find a way to convert the object to a string and then filter but could not find a way to do that either. </p>

<p><code>dropna</code> does not work in-place: you have to assign the result to the dataframe itself or it will be lost:</p>

<pre><code> df = df.dropna(subset=['result'])
</code></pre>

python pandas