cudf.Series.from_masked_array#
- classmethod Series.from_masked_array(data, mask, null_count=None)[source]#
Create a Series with null-mask. This is equivalent to:
Series(data).set_mask(mask, null_count=null_count)
- Parameters:
- data1D array-like
The values. Null values must not be skipped. They can appear as garbage values.
- mask1D array-like
The null-mask. Valid values are marked as
1
; otherwise0
. The mask bit given the data indexidx
is computed as:(mask[idx // 8] >> (idx % 8)) & 1
- null_countint, optional
The number of null values. If None, it is calculated automatically.
- Returns:
- Series
Examples
>>> 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