[ Web Proxy ]
URL:
Viewing: https://arrow.apache.org/docs/python/api/../api/../generated/pyarrow.compute.case_when.html [Back]  [Original]

pyarrow.compute.case_when — Apache Arrow v25.0.1
Back to top
Search the docs ...:

pyarrow.compute.case_when#

pyarrow.compute.case_when(cond, /, *cases, memory_pool=None)#

Choose values based on multiple conditions.

cond must be a struct of Boolean values. cases can be a mix of scalar and array arguments (of any type, but all must be the same type or castable to a common type), with either exactly one datum per child of cond, or one more cases than children of cond (in which case we have an else value).

Each row of the output will be the corresponding value of the first datum in cases for which the corresponding child of cond is true, or otherwise the else value (if given), or null.

Essentially, this implements a switch-case or if-else, if-else statement.

Parameters:
condArray-like or scalar-like

Argument to compute function.

*casesArray-like or scalar-like

Argument to compute function.

memory_poolpyarrow.MemoryPool, optional

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


Web Proxy Viewer  |  New URL  |  Original Page