Skip to content
Advertisement

Dask “Column assignment doesn’t support type numpy.ndarray”

I’m trying to use Dask instead of pandas since the data size I’m analyzing is quite large. I wanted to add a flag column based on several conditions.

JavaScript

But, then I got the following error message. The above code works perfectly when using np.where with pandas dataframe, but didn’t work with dask.array.where.

enter image description here

Advertisement

Answer

If numpy works and the operation is row-wise, then one solution is to use .map_partitions:

JavaScript
Advertisement