Item assignment to Python dask array objects

Viewed 3671

I've created a Python dask array and I'm trying to modify a slice of the array as follows:

import numpy as np
import dask.array as da

x = np.random.random((20000, 100, 100)) # Create numpy array
dx = da.from_array(x, chunks=(x.shape[0], 10, 10)) # Create dask array from numpy array

dx[:50, :, :] = 0 # Modify a slice of the dask array

Such an attempt to modify the dask array raises the exception:

TypeError: 'Array' object does not support item assignment

Is there a way to modify a dask array slice without raising an exception?

1 Answers
Related