Check that map_partitions can handle a dask array input
(c, s, a, b)
| 757 | @pytest.mark.xfail(reason="roundtripping through arrays doesn't work yet") |
| 758 | @gen_cluster(client=True) |
| 759 | async 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 | |
| 777 | def test_map_partitions_df_input(): |
nothing calls this directly
no test coverage detected