Is this a mistake?

Hi, community.

Suddenly i was checking my solution with provided notebook and found a step that’s really questionable for me.
Link for provided solution notebook:

Step 7 in “Spending money for living”:

Keep only the rows with non-nulls in the money_per_month column

fcc_good = fcc_good[fcc_good[‘money_per_month’].notnull()]

When i do df.notnull() in ‘money spent per month’ here i get same size of dataframe, but with 1844 zero values:

Is df.notnull() is right solution here, or is it better to write something like this:

fcc_good = fcc_good[fcc_good[‘money_per_month’] > 0.0]

Thanks, for your support >.<

I think you are going absolutely right by using notnull() .

Requirement of task is to exclude Null values not zeroes .

notnull() only filters out all np.Nan values . Zeroes will be (and should be ) there.

Your thinking is right but is the name of the method that creates this confusion.

The notnull() method by definition makes the following:

takes a scalar or array-like object and indictates whether values are valid
Here valid means not missing, which is NaN in numeric arrays, None or NaN in object arrays, NaT in datetimelike

Then, the line where you are using notnull() is filtering out any non valid value, while keeping the zeros.