Selecting pandas cells with None value Selecting pandas cells with None value python python

Selecting pandas cells with None value


Call it like this:

yes_records_sample['name'].isnull()


I couldn't find any built-in which does exactly this, so I do it manually. In case of Series, the code is this:

import numpy as npseries = yes_records_sample['name']n = np.empty_like(series)n[...] = Nonenones = series.values == n

In case of DataFrames, the code is very similar:

import numpy as npdf = yes_records_samplen = np.empty_like(df)n[...] = Nonenones = df == n

My problem with .isnull() is that it does not distinguish between NaN and None. This may or may not be a problem in your application.