(condition, x=None, y=None)
| 220 | |
| 221 | @derived_from(np.ma.core) |
| 222 | def where(condition, x=None, y=None): |
| 223 | if (x is None) != (y is None): |
| 224 | raise ValueError("either both or neither of x and y should be given") |
| 225 | if (x is None) and (y is None): |
| 226 | return nonzero(condition) |
| 227 | else: |
| 228 | return elemwise(np.ma.where, condition, x, y) |