0
import pandas as pd
t1=pd.DataFrame()
t1 ['name'] = ["dp","ag","wp"]
t1['status'] = ['a','b','c']
t1['age'] = [10,"",15]
t1
##
print(t1.isnull().values)

Why is the execution of this node not able to identify blank (see "age" column, 2nd row). isnull() is coming false for all the cells, see below output Output:

 [[False False False] 
 [False False False] 
 [False False False]] 

1 Answer 1

1

Because empty string is not same like missing value. So correct test for it is:

print(t1.eq('').values)

Or:

print((t1 == '').values)

If want test empty strings or missing values chain both mask with | for bitwise OR:

print((t1.isnull() | t1.eq('')).values)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, but then what would a null look like in the dataframe? Because, even the space is not being captured by isnull() , nor the 'NULL' is being captured... I tried to check with that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.