where¶
-
sparse.
where
(condition, x=None, y=None)[source]¶ Select values from either
x
ory
depending oncondition
. Ifx
andy
are not given, returns indices wherecondition
is nonzero.Performs the equivalent of
numpy.where
.- Parameters
condition (SparseArray) – The condition based on which to select values from either
x
ory
.x (SparseArray, optional) – The array to select values from if
condition
is nonzero.y (SparseArray, optional) – The array to select values from if
condition
is zero.
- Returns
The output array with selected values if
x
andy
are given; else where the array is nonzero.- Return type
- Raises
ValueError – If the operation would produce a dense result; or exactly one of
x
andy
are given.
See also
numpy.where()
Equivalent Numpy function.