Michael Discenza Michael Discenza - 4 months ago 20
Python Question

Selecting pandas cells with None value

I have have a column of a pandas dataframe that I got from a database query with blanck cells. The blank cells become "None" and I want to check if each of the rows is None:

In [325]: yes_records_sample['name']
41055 John J Murphy Professional Building
25260 None
41757 Armand Bayou Nature Center
31397 None
33104 Hubert Humphrey Building
16891 Williams Hall
29618 None
3770 Covenant House
39618 None
1342 Bhathal Student Services Building
20506 None

My understanding per the documentation is that I can check if each row is null with
command http://pandas.pydata.org/pandas-docs/dev/missing_data.html#values-considered-missing

That function, however, is not working for me:

In [332]: isnull(yes_records_sample['name'])

I get the following error:

NameError Traceback (most recent call last)
<ipython-input-332-55873906e7e6> in <module>()
----> 1 isnull(yes_records_sample['name'])
NameError: name 'isnull' is not defined

I also saw that someone just replaced the "None" strings, but neither of these variations on that approach worked for me:
Rename "None" value in Pandas

yes_records_sample['name'].replace('None', "--no value--")
yes_records_sample['name'].replace(None, "--no value--")

I was ultimately able to use the
function and fill each of those rows with an empty string
as a workaround and then I could check
But I am profoundly confused by how 'None' works and what it means. Is there a way to easily just check if a cell in a dataframe is 'None'?


Call it like this: