用法:
Series.notnull()
Series.notnull 是 Series.notna 的別名。
檢測現有(非缺失)值。
返回一個布爾值相同大小的對象,指示值是否不是 NA。非缺失值被映射為 True。空字符串
''
或numpy.inf
等字符不被視為 NA 值(除非您設置pandas.options.mode.use_inf_as_na = True
)。 NA 值,例如 None 或numpy.NaN
,被映射到 False 值。- Series
Series 中每個元素的布爾值掩碼,指示元素是否不是 NA 值。
返回:
例子:
顯示 DataFrame 中的哪些條目不是 NA。
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN], ... born=[pd.NaT, pd.Timestamp('1939-05-27'), ... pd.Timestamp('1940-04-25')], ... name=['Alfred', 'Batman', ''], ... toy=[None, 'Batmobile', 'Joker'])) >>> df age born name toy 0 5.0 NaT Alfred None 1 6.0 1939-05-27 Batman Batmobile 2 NaN 1940-04-25 Joker
>>> df.notna() age born name toy 0 True False True False 1 True True True True 2 False True True True
顯示 Series 中的哪些條目不是 NA。
>>> ser = pd.Series([5, 6, np.NaN]) >>> ser 0 5.0 1 6.0 2 NaN dtype:float64
>>> ser.notna() 0 True 1 True 2 False dtype:bool
相關用法
- Python pandas.Series.notna用法及代碼示例
- Python pandas.Series.nsmallest用法及代碼示例
- Python pandas.Series.name用法及代碼示例
- Python pandas.Series.nunique用法及代碼示例
- Python pandas.Series.ne用法及代碼示例
- Python pandas.Series.nlargest用法及代碼示例
- Python pandas.Series.add_prefix用法及代碼示例
- Python pandas.Series.map用法及代碼示例
- Python pandas.Series.max用法及代碼示例
- Python pandas.Series.str.isdecimal用法及代碼示例
- Python pandas.Series.str.get用法及代碼示例
- Python pandas.Series.to_csv用法及代碼示例
- Python pandas.Series.dt.day_name用法及代碼示例
- Python pandas.Series.sample用法及代碼示例
- Python pandas.Series.head用法及代碼示例
- Python pandas.Series.eq用法及代碼示例
- Python pandas.Series.plot.line用法及代碼示例
- Python pandas.Series.to_pickle用法及代碼示例
- Python pandas.Series.between_time用法及代碼示例
- Python pandas.Series.reindex_like用法及代碼示例
注:本文由純淨天空篩選整理自pandas.pydata.org大神的英文原創作品 pandas.Series.notnull。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。