DataFrame.notna / DataFrame.notnull
DataFrame.notna() / DataFrame.notnull()
返回一个布尔大小相同的对象,指示值是否不是NA。非缺失值被映射为True。
举例:
import pandas as pd
import numpy as np
df = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'],
'age':[18, 39, 22, np.NaN],
'price': [1.0, 2.0, 3.0, 4.0]})
df.notnull()
-------------------------------------------------------
site age price
0 True True True
1 True True True
2 True True True
3 True False True