You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [1]: importnumpyasnpIn [2]: importdask.arrayasdaIn [3]: x=np.asarray([[1, 2]])
In [4]: y=np.asarray([[3, 4]])
In [5]: i=np.asarray([True])
In [6]: xd=da.asarray(x)
In [7]: yd=da.asarray(y)
In [8]: id=da.asarray(i)
In [9]: x[i] =y[i]
In [10]: xOut[10]: array([[3, 4]])
In [11]: xd[id] =yd[id]
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
CellIn[11], line1---->1xd[id] =yd[id]
File~/programming/pixi-dev-scipystack/scipy/.pixi/envs/array-api/lib/python3.12/site-packages/dask/array/core.py:1903, inArray.__setitem__(self, key, value)
1900fromdask.array.routinesimportwhere1902ifisinstance(value, Array) andvalue.ndim>1:
->1903raiseValueError("boolean index array should have 1 dimension")
1904try:
1905y=where(key, value, self)
ValueError: booleanindexarrayshouldhave1dimensionIn [12]: yd[id].ndimOut[12]: 2
Anything else we need to know?:
I think the error message is unclear too. I initially thought that the "boolean index array" referred to id here (the index array), as opposed to yd[id], the value array being assigned.
The text was updated successfully, but these errors were encountered:
This works in NumPy, but fails in Dask.
Anything else we need to know?:
I think the error message is unclear too. I initially thought that the "boolean index array" referred to
id
here (the index array), as opposed toyd[id]
, the value array being assigned.The text was updated successfully, but these errors were encountered: