用法:
classmethod Series.from_masked_array(data, mask, null_count=None)
使用null-mask 創建一個係列。這相當於:
係列(數據)。set_mask(掩碼,null_count=null_count)
- data:一維array-like
值。不得跳過空值。它們可以顯示為垃圾值。
- mask:一維array-like
null-mask。有效值標記為
1
;否則0
。給定數據索引idx
的掩碼位計算如下:(mask[idx // 8] >> (idx % 8)) & 1
- null_count:整數,可選
空值的數量。如果沒有,則自動計算。
- Series
參數:
返回:
例子:
>>> import cudf >>> a = cudf.Series([1, 2, 3, None, 4, None]) >>> a 0 1 1 2 2 3 3 <NA> 4 4 5 <NA> dtype: int64 >>> b = cudf.Series([10, 11, 12, 13, 14]) >>> cudf.Series.from_masked_array(data=b, mask=a._column.mask) 0 10 1 11 2 12 3 <NA> 4 14 dtype: int64
相關用法
- Python cudf.Series.from_pandas用法及代碼示例
- Python cudf.Series.from_categorical用法及代碼示例
- Python cudf.Series.from_arrow用法及代碼示例
- Python cudf.Series.floordiv用法及代碼示例
- Python cudf.Series.fillna用法及代碼示例
- Python cudf.Series.factorize用法及代碼示例
- Python cudf.Series.first用法及代碼示例
- Python cudf.Series.floor用法及代碼示例
- 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用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.from_masked_array。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。