where¶
- where(condition: array, x1: array, x2: array, /) array¶
Returns elements chosen from
x1orx2depending oncondition.- Parameters:
condition (array) – when
True, yieldx1_i; otherwise, yieldx2_i. Should have a boolean data type. Must be compatible withx1andx2(see Broadcasting).x1 (array) – first input array. Must be compatible with
conditionandx2(see Broadcasting).x2 (array) – second input array. Must be compatible with
conditionandx1(see Broadcasting).
- Returns:
out (array) – an array with elements from
x1whereconditionisTrue, and elements fromx2elsewhere. The returned array must have a data type determined by Type Promotion Rules rules with the arraysx1andx2.