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

Function test_resample_agg

dask/dataframe/tseries/tests/test_resample_expr.py:110–125  ·  view source on GitHub ↗
(df, pdf)

Source from the content-addressed store, hash-verified

108
109
110def test_resample_agg(df, pdf):
111 def my_sum(vals, foo=None, *, bar=None):
112 return vals.sum()
113
114 result = df.resample("2min").agg(my_sum, "foo", bar="bar")
115 expected = pdf.resample("2min").agg(my_sum, "foo", bar="bar")
116 assert_eq(result, expected)
117
118 result = df.resample("2min").agg(my_sum)["foo"]
119 expected = pdf.resample("2min").agg(my_sum)["foo"]
120 assert_eq(result, expected)
121
122 # simplify up disabled for `agg`, function may access other columns
123 q = df.resample("2min").agg(my_sum)["foo"].simplify()
124 eq = df["foo"].resample("2min").agg(my_sum).simplify()
125 assert q._name != eq._name
126
127
128@pytest.mark.parametrize("method", ["count", "nunique", "size", "sum"])

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
resampleMethod · 0.80
aggMethod · 0.45
simplifyMethod · 0.45

Tested by

no test coverage detected