pyarrow.compute.choose

pyarrow.compute.choose(indices, /, *values, memory_pool=None)

Choose values from several arrays.

For each row, the value of the first argument is used as a 0-based index into the list of values arrays (i.e. index 0 selects the first of the values arrays). The output value is the corresponding value of the selected argument.

If an index is null, the output will be null.

Parameters
indicesArray-like or scalar-like

Argument to compute function.

*valuesArray-like or scalar-like

Argument to compute function.

memory_poolpyarrow.MemoryPool, optional

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