'Check if cell of row in pandas dataframe contains NaN

I have a pandas dataframe which I want to use to create an xml file from. I need to create different child elements depending on if certain rows contain NaN or not.

I have the below if statement, but it never gets evaluated as true..

if(pd.notna(row.ErrorCode)):

An example of a row in my dataframe for which I would want this to be evaluated as True is ..

01N037757341    NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN E2230   System exception encountered processin...   AB231   00AX    2022-04-12  TN08RRO

The errorCode is in the correct ErrorCode field but it doesn't recognise this as notna. I have tried notnull as well, but can't get this to work.

Any help would be much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source