MCPcopy Create free account
hub / github.com/dask/dask / new_da_object

Function new_da_object

dask/array/core.py:5954–5966  ·  view source on GitHub ↗

Generic constructor for dask.array or dask.dataframe objects. Decides the appropriate output class based on the type of `meta` provided.

(dsk, name, chunks, meta=None, dtype=None)

Source from the content-addressed store, hash-verified

5952
5953
5954def new_da_object(dsk, name, chunks, meta=None, dtype=None):
5955 """Generic constructor for dask.array or dask.dataframe objects.
5956
5957 Decides the appropriate output class based on the type of `meta` provided.
5958 """
5959 if is_dataframe_like(meta) or is_series_like(meta) or is_index_like(meta):
5960 from dask.dataframe import from_graph
5961
5962 assert all(len(c) == 1 for c in chunks[1:])
5963 divisions = [None] * (len(chunks[0]) + 1)
5964 return from_graph(dict(dsk), meta, divisions, dsk.layers[name].keys(), name)
5965 else:
5966 return Array(dsk, name=name, chunks=chunks, meta=meta, dtype=dtype)
5967
5968
5969class BlockView:

Callers 1

blockwiseFunction · 0.90

Calls 7

is_dataframe_likeFunction · 0.90
is_series_likeFunction · 0.90
is_index_likeFunction · 0.90
allFunction · 0.90
from_graphFunction · 0.90
ArrayClass · 0.70
keysMethod · 0.45

Tested by

no test coverage detected