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

Function test_dataframe_into_delayed

dask/dataframe/tests/test_dataframe.py:5344–5358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5342
5343
5344def test_dataframe_into_delayed():
5345 pdf = pd.DataFrame({"a": [1, 2, 3], "b": 1})
5346 df = dd.from_pandas(pdf, npartitions=2)
5347
5348 def test_func(df):
5349 return df.sum().sum()
5350
5351 def delayed_func(i):
5352 # sanity check
5353 assert i.sum() == 6
5354
5355 df = df[["a"]].map_partitions(test_func, meta=(None, int))
5356 result = delayed(delayed_func)(df)
5357 assert sum(map(len, result.dask.layers.values())) == 6
5358 result.compute()
5359
5360
5361def test_array_to_df_conversion():

Callers

nothing calls this directly

Calls 5

delayedFunction · 0.90
sumFunction · 0.50
map_partitionsMethod · 0.45
valuesMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected