close

[Solved] Error: float object has no attribute notnull

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Error: float object has no attribute notnull in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Error: float object has no attribute notnull Error Occurs?

Today I get the following error Error: float object has no attribute notnull in python.

How To Solve Error: float object has no attribute notnull Error ?

  1. How To Solve Error: float object has no attribute notnull Error ?

    To Solve Error: float object has no attribute notnull Error Use
    pd.isnull(df['Description'][i])
    or
    pd.isna(df['Description'][i])

  2. Error: float object has no attribute notnull

    To Solve Error: float object has no attribute notnull Error Use
    pd.isnull(df['Description'][i])
    or
    pd.isna(df['Description'][i])

Solution 1

You don’t need apply, use np.where:

df['d'] = np.where(df.a.isnull(),
         np.nan,
         np.where((df.b == "N")&(~df.c.isnull()),
                  df.a*df.c,
                  df.a))

Output:

      a  b    c     d
0   NaN  Y  NaN   NaN
1  23.0  N  3.0  69.0
2   NaN  N  2.0   NaN
3  44.0  Y  NaN  44.0

Solution 2

Use

pd.isnull(df['Description'][i])

or

pd.isna(df['Description'][i])

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read