torcharrow.if_else¶
- torcharrow.if_else(cond: Column, left: Column, right: Column)¶
Return a column of elements where each of them is selected from either left column or righ column, depending on the value in the corresponding position in cond column.
Examples
>>> import torcharrow as ta >>> cond = ta.column([True, False, True, False]) >>> left = ta.column(["a1", "a2", "a3", "a4"]) >>> right = ta.column(["b1", "b2", "b3", "b4"]) >>> ta.if_else(cond, left, right) 0 'a1' 1 'b2' 2 'a3' 3 'b4' dtype: string, length: 4, null_count: 0, device: cpu