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 mixof scalar and array arguments (of any type, but all must be thesame type or castable to a common type), with either exactly onedatum per child ofcond, or one morecases than children ofcond (in which case we have an “else” value).
Each row of the output will be the corresponding value of thefirst datum incases for which the corresponding child ofcondis 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_pool
pyarrow.MemoryPool, optional If not passed, will allocate memory from the default memory pool.
On this page

