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

Function test_pivot_table

dask/dataframe/dask_expr/tests/test_reshape.py:31–54  ·  view source on GitHub ↗
(df, pdf, aggfunc)

Source from the content-addressed store, hash-verified

29
30@pytest.mark.parametrize("aggfunc", ["first", "last", "sum", "mean", "count"])
31def test_pivot_table(df, pdf, aggfunc):
32 assert_eq(
33 df.pivot_table(index="x", columns="y", values="z", aggfunc=aggfunc),
34 pdf.pivot_table(
35 index="x", columns="y", values="z", aggfunc=aggfunc, observed=False
36 ),
37 check_dtype=aggfunc != "count",
38 )
39
40 assert_eq(
41 df.pivot_table(index="x", columns="y", values=["z", "a"], aggfunc=aggfunc),
42 pdf.pivot_table(
43 index="x", columns="y", values=["z", "a"], aggfunc=aggfunc, observed=False
44 ),
45 check_dtype=aggfunc != "count",
46 )
47
48 assert_eq(
49 pivot_table(df, index="x", columns="y", values=["z", "a"], aggfunc=aggfunc),
50 pdf.pivot_table(
51 index="x", columns="y", values=["z", "a"], aggfunc=aggfunc, observed=False
52 ),
53 check_dtype=aggfunc != "count",
54 )
55
56
57def test_pivot_table_fails(df):

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
pivot_tableFunction · 0.90
pivot_tableMethod · 0.80

Tested by

no test coverage detected