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

Function test_split_out_automatically

dask/dataframe/dask_expr/tests/test_groupby.py:360–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

358
359
360def test_split_out_automatically():
361 pdf = pd.DataFrame({"a": [1, 2, 3] * 1_000, "b": 1, "c": 1, "d": 1})
362 df = from_pandas(pdf, npartitions=500)
363 q = df.groupby("a").sum()
364 assert q.optimize().npartitions == 34
365 expected = pdf.groupby("a").sum()
366 assert_eq(q, expected)
367
368 q = df.groupby(["a", "b"]).sum()
369 assert q.optimize().npartitions == 50
370 expected = pdf.groupby(["a", "b"]).sum()
371 assert_eq(q, expected)
372
373 q = df.groupby(["a", "b", "c"]).sum()
374 assert q.optimize().npartitions == 100
375 expected = pdf.groupby(["a", "b", "c"]).sum()
376 assert_eq(q, expected)
377
378
379def test_split_out_sort_values_compute(pdf, df):

Callers

nothing calls this directly

Calls 6

groupbyMethod · 0.95
from_pandasFunction · 0.90
assert_eqFunction · 0.90
sumMethod · 0.45
groupbyMethod · 0.45
optimizeMethod · 0.45

Tested by

no test coverage detected