Reputation: 1
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]]
Upvotes: 0
Views: 1634
Reputation: 862781
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)
Upvotes: 1