Python Pandas find all rows where all values are NaN

It should just be:

df.isnull().all(1)

The index can be accessed like:

df.index[df.isnull().all(1)]

Demonstration

np.random.seed([3,1415])
df = pd.DataFrame(np.random.choice((1, np.nan), (10, 2)))
df

enter image description here

idx = df.index[df.isnull().all(1)]
nans = df.ix[idx]
nans

enter image description here


Timing

code

np.random.seed([3,1415])
df = pd.DataFrame(np.random.choice((1, np.nan), (10000, 5)))

enter image description here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)