MCPcopy
hub / github.com/dask/dask / test_to_dask_array

Function test_to_dask_array

dask/dataframe/tests/test_dataframe.py:2831–2846  ·  view source on GitHub ↗
(meta, as_frame, lengths)

Source from the content-addressed store, hash-verified

2829 ],
2830)
2831def test_to_dask_array(meta, as_frame, lengths):
2832 s = pd.Series([1, 2, 3, 4, 5], name="foo", dtype="i4")
2833 a = dd.from_pandas(s, chunksize=2)
2834
2835 if as_frame:
2836 a = a.to_frame()
2837
2838 result = a.to_dask_array(lengths=lengths, meta=meta)
2839 assert isinstance(result, da.Array)
2840
2841 expected_chunks = ((2, 2, 1),)
2842
2843 if as_frame:
2844 expected_chunks = expected_chunks + ((1,),)
2845
2846 assert result.chunks == expected_chunks
2847
2848
2849def test_to_dask_array_single_partition():

Callers

nothing calls this directly

Calls 2

to_dask_arrayMethod · 0.80
to_frameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…