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 ofxandyare given.See also
numpy.where()- Equivalent Numpy function.
- condition (SparseArray) – The condition based on which to select values from
either