pyarrow.compute.if_else

pyarrow.compute.if_else(cond, left, right, /, *, memory_pool=None)

Choose values based on a condition.

cond must be a Boolean scalar/ array. left or right must be of the same type scalar/ array. null values in cond will be promoted to the output.

Parameters:
condArray-like or scalar-like

Argument to compute function.

leftArray-like or scalar-like

Argument to compute function.

rightArray-like or scalar-like

Argument to compute function.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.