pyarrow.compute.choose

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

Given indices and arrays, choose the value from the corresponding array for each index.

For each row, the value of the first argument is used as a 0-based index into the rest of the arguments (i.e. index 0 selects the second argument). The output value is the corresponding value of the selected argument. If an index is null, the output will be null.

Parameters
  • indices (Array-like or scalar-like) – Argument to compute function

  • *values (Array-like or scalar-like) – Argument to compute function

  • memory_pool (pyarrow.MemoryPool, optional) – If not passed, will allocate memory from the default memory pool.