pyarrow.compute.replace_with_mask¶
- pyarrow.compute.replace_with_mask(values, mask, replacements, /, *, memory_pool=None)¶
Replace items selected with a mask.
Given an array and a boolean mask (either scalar or of equal length), along with replacement values (either scalar or array), each element of the array for which the corresponding mask element is true will be replaced by the next value from the replacements, or with null if the mask is null. Hence, for replacement arrays, len(replacements) == sum(mask == true).
- Parameters:
- valuesArray-like
Argument to compute function.
- maskArray-like
Argument to compute function.
- replacementsArray-like
Argument to compute function.
- memory_pool
pyarrow.MemoryPool
, optional If not passed, will allocate memory from the default memory pool.