I have 2 columns in the python dataframe.
I want to check each row in my Column A for any value that is NOT == NaN.
If the value is found then append the corresponding row with 'P' IF NaN value then 'B'
In excel, I could use =if(A1="","B","P" assuming that a cell is empty and not NAN
I think my excel background is confusing me as to what is considered empty or null vs what is the NaN value.
<<Test Frame>>
Column A | Column B
1 NaN NaN
2 John NaN
3 Dave NaN
4 NaN NaN
5 Michael NaN
Output:
<<Desired Output>>
Column A | Column B
1 NaN B
2 John P
3 Dave P
4 NaN B
5 Michael P
I have researched but couldn't find the fit for this particular purpose.
Select the correct answer from above options