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

Function _partition_from_array

dask/dataframe/io/io.py:82–99  ·  view source on GitHub ↗

Create a Dask partition for either a DataFrame or Series. Designed to be used with :func:`dask.blockwise.blockwise`. ``data`` is the array from which the partition will be created. ``index`` can be: 1. ``None``, in which case each partition has an independent RangeIndex 2. a `tuple

(data, index=None, initializer=None, **kwargs)

Source from the content-addressed store, hash-verified

80
81
82def _partition_from_array(data, index=None, initializer=None, **kwargs):
83 """Create a Dask partition for either a DataFrame or Series.
84
85 Designed to be used with :func:`dask.blockwise.blockwise`. ``data`` is the array
86 from which the partition will be created. ``index`` can be:
87
88 1. ``None``, in which case each partition has an independent RangeIndex
89 2. a `tuple` with two elements, the start and stop values for a RangeIndex for
90 this partition, which gives a continuously varying RangeIndex over the
91 whole Dask DataFrame
92 3. an instance of a ``pandas.Index`` or a subclass thereof
93
94 The ``kwargs`` _must_ contain an ``initializer`` key which is set by calling
95 ``type(meta)``.
96 """
97 if isinstance(index, tuple):
98 index = pd.RangeIndex(*index)
99 return initializer(data, index=index, **kwargs)
100
101
102def from_dask_array(x, columns=None, index=None, meta=None):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected