用法:
property Series.empty
指示 DataFrame 或 Series 是否為空。
如果 DataFrame/Series 完全為空(沒有項目),則為真,這意味著任何軸的長度為 0。
- out:bool
如果 DataFrame/Series 為空,則返回 True,否則返回 False。
返回:
注意:
如果 DataFrame/Series 僅包含
null
值,它仍然不被認為是空的。請參見下麵的示例。例子:
>>> import cudf >>> df = cudf.DataFrame({'A' : []}) >>> df Empty DataFrame Columns: [A] Index: [] >>> df.empty True
如果我們的 DataFrame 中隻有
null
值,則它不被認為是空的!我們需要刪除null
以使 DataFrame 為空:>>> df = cudf.DataFrame({'A' : [None, None]}) >>> df A 0 <NA> 1 <NA> >>> df.empty False >>> df.dropna().empty True
非空和空係列示例:
>>> s = cudf.Series([1, 2, None]) >>> s 0 1 1 2 2 <NA> dtype: int64 >>> s.empty False >>> s = cudf.Series([]) >>> s Series([], dtype: float64) >>> s.empty True
相關用法
- Python cudf.Series.equals用法及代碼示例
- Python cudf.Series.explode用法及代碼示例
- Python cudf.Series.exp用法及代碼示例
- Python cudf.Series.eq用法及代碼示例
- Python cudf.Series.ceil用法及代碼示例
- Python cudf.Series.update用法及代碼示例
- Python cudf.Series.max用法及代碼示例
- Python cudf.Series.head用法及代碼示例
- Python cudf.Series.reindex用法及代碼示例
- Python cudf.Series.interleave_columns用法及代碼示例
- Python cudf.Series.min用法及代碼示例
- Python cudf.Series.nlargest用法及代碼示例
- Python cudf.Series.to_frame用法及代碼示例
- Python cudf.Series.mask用法及代碼示例
- Python cudf.Series.notnull用法及代碼示例
- Python cudf.Series.isnull用法及代碼示例
- Python cudf.Series.rmod用法及代碼示例
- Python cudf.Series.map用法及代碼示例
- Python cudf.Series.nsmallest用法及代碼示例
- Python cudf.Series.data用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.empty。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。