where
Select values from either x
or y
depending on condition
.
If x
and y
are not given, returns indices where condition
is nonzero.
Performs the equivalent of numpy.where
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition
|
SparseArray
|
The condition based on which to select values from
either |
required |
x
|
SparseArray
|
The array to select values from if |
None
|
y
|
SparseArray
|
The array to select values from if |
None
|
Returns:
Type | Description |
---|---|
COO
|
The output array with selected values if |
Raises:
Type | Description |
---|---|
ValueError
|
If the operation would produce a dense result; or exactly one of
|
See Also
numpy.where
: Equivalent Numpy function.
Source code in sparse/numba_backend/_coo/common.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
|