dask.array.asarray(a, allow_unknown_chunksizes=False, *, like=None, **kwargs)[source]

Convert the input to a dask array.


Input data, in any form that can be converted to a dask array.

allow_unknown_chunksizes: bool

Allow unknown chunksizes, such as come from converting from dask dataframes. Dask.array is unable to verify that chunks line up. If data comes from differently aligned sources then this can cause unexpected results.

like: array-like

Reference object to allow the creation of Dask arrays with chunks that are not NumPy arrays. If an array-like passed in as like supports the __array_function__ protocol, the chunk type of the resulting array will be definde by it. In this case, it ensures the creation of a Dask array compatible with that passed in via this argument. If like is a Dask array, the chunk type of the resulting array will be defined by the chunk type of like. Requires NumPy 1.20.0 or higher.

outdask array

Dask array interpretation of a.


>>> import dask.array as da
>>> import numpy as np
>>> x = np.arange(3)
>>> da.asarray(x)
dask.array<array, shape=(3,), dtype=int64, chunksize=(3,), chunktype=numpy.ndarray>
>>> y = [[1, 2, 3], [4, 5, 6]]
>>> da.asarray(y)
dask.array<array, shape=(2, 3), dtype=int64, chunksize=(2, 3), chunktype=numpy.ndarray>