Pandas - dropping rows with missing data not working using .isnull(), notnull(), dropna()
<p>This is really weird. I have tried several ways of dropping rows with missing data from a pandas dataframe, but none of them seem to work.
This is the code (I just uncomment one of the methods used - but these are the three that I used in different modifications - this is the latest):</p>

<pre><code>import pandas as pd
Test = pd.DataFrame({'A':[1,2,3,4,5],'B':[1,2,'NaN',4,5],'C':[1,2,3,'NaT',5]})
print(Test)
#Test = Test.ix[Test.C.notnull()]
#Test = Test.dropna()
Test = Test[~Test[Test.columns.values].isnull()]
print "And now"
print(Test)
</code></pre>

<p>But in all cases, all I get is this:</p>

<pre><code>   A    B    C
0  1    1    1
1  2    2    2
2  3  NaN    3
3  4    4  NaT
4  5    5    5
And now
   A    B    C
0  1    1    1
1  2    2    2
2  3  NaN    3
3  4    4  NaT
4  5    5    5
</code></pre>

<p>Is there any mistake that I am making? or what is the problem? Ideally, I would like to get this:</p>

<pre><code>   A    B    C
0  1    1    1
1  2    2    2
4  5    5    5
</code></pre>

<p>Try this on orig data: </p>

<pre><code>Test.replace(["NaN", 'NaT'], np.nan, inplace = True)
Test = Test.dropna()
Test
</code></pre>

<p>Or Modify data and do this </p>

<pre><code>import pandas as pd
Test = pd.DataFrame({'A':[1,2,3,4,5],'B':[1,2,np.nan,4,5],'C':[1,2,3,pd.NaT,5]})
print(Test)
Test = Test.dropna()
print(Test)



   A    B  C
0  1  1.0  1
1  2  2.0  2
4  5  5.0  5
</code></pre>

python pandas