index of non "NaN" values in Pandas
Just filter them
In [62]:
df['b'].notnull()
Out[62]:
0 True
1 False
2 True
3 True
4 True
Name: b, dtype: bool
In [63]:
df[df['b'].notnull()]
Out[63]:
A b c
0 1 q1 1
2 3 q2 3
3 4 q1 NaN
4 5 q2 7
DataFrames have a dropna
method:
import pandas
import numpy
d = pandas.DataFrame({'A': [1, 2, 3, numpy.nan],
'b': [1, 2, numpy.nan, 3],
'c': [1, numpy.nan, 2, 3]})
d.dropna(subset=['b'])