ENH: provide default value for `less`, `greater`, etc when used with `where`
Open
Nobody has claimed this yet.
01 - Enhancement
component: numpy.ufunc
- Dominant language
- Python
- Stars
- 32.8k
- Forks
- 12.8k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 197
Description
Proposed new feature or change:
It would be convenient to do something like:
np.less(a, b, where=c, out=False)
instead of something like
default = np.zeros_like(a, dtype=bool)
np.less(a, b, where=c, out=default)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the np.less ufunc entry point and inspect how where and out are currently handled, along with existing tests for masked ufunc operations. Compare the proposed default-value behavior with the current out workaround and define consistent behavior for less, greater, and related operations before adding coverage that verifies the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100