I have a data frame created with Pandas that contains numbers. I need to check if the values that I extract from this data frame are nulls or zeros. So I am trying the following:
a = df.ix[[0], ['Column Title']].values
if a != 0 or not math.isnan(float(a)):
print "It is neither a zero nor null"
While it does appear to work, sometimes I get the following error:
TypeError: don't know how to convert scalar number to float
What am I doing wrong?
athat causes the error.df[df['Column Title'] is not None]?np.nanby default in pandasmath.isnan(np.nan) == np.nan