Skip to content

Improve user experience of interacting with numpy arrays #290

@mrocklin

Description

@mrocklin

Currently when numpy arrays interact with dask arrays we swallow errors silently, revealing them only at computation time.

In [1]: import dask.array as da
In [2]: import numpy as np
In [3]: x = da.arange(15, chunks=5)
In [4]: y = np.arange(15)

In [5]: x + y
Out[5]: dask.array<x_1, shape=(15,), chunks=((5, 5, 5)), dtype=int64>

In [6]: _.compute()
ValueError: operands could not be broadcast together with shapes (5,) (15,) 

We should do one of the following things:

  1. Figure out automatic conversion of a numpy array into a dask array with appropriate shape to make the operation work (hard in general, maybe easy in a few key cases)
  2. Raise an informative error early on (maybe easier in the hard cases)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions