where¶
- where(condition: array, x1: array, x2: array, /) array ¶
Returns elements chosen from
x1
orx2
depending oncondition
.- Parameters:
condition (array) – when
True
, yieldx1_i
; otherwise, yieldx2_i
. Must be compatible withx1
andx2
(see Broadcasting).x1 (array) – first input array. Must be compatible with
condition
andx2
(see Broadcasting).x2 (array) – second input array. Must be compatible with
condition
andx1
(see Broadcasting).
- Returns:
out (array) – an array with elements from
x1
wherecondition
isTrue
, and elements fromx2
elsewhere. The returned array must have a data type determined by Type Promotion Rules rules with the arraysx1
andx2
.