mars-project / mars-project/mars
Implement set values by boolean indexing
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Description
`setitem` is now only support slice or int, we can implement set values by boolean indexing.
``` Python
In [1]: a = mt.random.rand(5, 5, chunk_size=3)
In [2]: a[a > 0.5] = 1
In [3]: a.execute()
Out[3]:
array([[1. , 0.4249057 , 1. , 1. , 1. ],
[1. , 0.13329489, 0.22285302, 0.16091528, 1. ],
[0.45884747, 0.20933834, 0.32894797, 0.37087946, 1. ],
[0.19214502, 1. , 1. , 0.28669773, 0.16544558],
[1. , 1. , 1. , 0.25927057, 1. ]])
```
Contributor guide
Research direction
Start by locating the existing setitem implementation and the indexing tests or entry points that currently handle slice and integer assignment. Reproduce the boolean-indexing example from the issue, then extend coverage so that assigning 1 to values selected by a boolean condition executes successfully and produces the expected array.
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
- 38/100