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