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

Function test_map_partitions_da_input

dask/tests/test_distributed.py:759–774  ·  view source on GitHub ↗

Check that map_partitions can handle a dask array input

(c, s, a, b)

Source from the content-addressed store, hash-verified

757@pytest.mark.xfail(reason="roundtripping through arrays doesn't work yet")
758@gen_cluster(client=True)
759async def test_map_partitions_da_input(c, s, a, b):
760 """Check that map_partitions can handle a dask array input"""
761 np = pytest.importorskip("numpy")
762 pd = pytest.importorskip("pandas")
763 da = pytest.importorskip("dask.array")
764 pytest.importorskip("dask.dataframe")
765 datasets = pytest.importorskip("dask.datasets")
766
767 def f(d, a):
768 assert isinstance(d, pd.DataFrame)
769 assert isinstance(a, np.ndarray)
770 return d
771
772 df = datasets.timeseries(freq="1d").persist()
773 arr = da.ones((1,), chunks=1).persist()
774 await c.compute(df.map_partitions(f, arr, meta=df._meta))
775
776
777def test_map_partitions_df_input():

Callers

nothing calls this directly

Calls 4

persistMethod · 0.45
onesMethod · 0.45
computeMethod · 0.45
map_partitionsMethod · 0.45

Tested by

no test coverage detected