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

Function test_groupby_transform_funcs

dask/dataframe/tests/test_groupby.py:2258–2280  ·  view source on GitHub ↗
(transformation)

Source from the content-addressed store, hash-verified

2256 "transformation", [lambda x: x.sum(), np.sum, "sum", pd.Series.rank]
2257)
2258def test_groupby_transform_funcs(transformation):
2259 pdf = pd.DataFrame(
2260 {
2261 "A": [1, 2, 3, 4] * 5,
2262 "B": np.random.randn(20),
2263 "C": np.random.randn(20),
2264 "D": np.random.randn(20),
2265 }
2266 )
2267 ddf = dd.from_pandas(pdf, 3)
2268
2269 with pytest.warns(UserWarning):
2270 # DataFrame
2271 assert_eq(
2272 pdf.groupby("A").transform(transformation),
2273 ddf.groupby("A").transform(transformation),
2274 )
2275
2276 # Series
2277 assert_eq(
2278 pdf.groupby("A")["B"].transform(transformation),
2279 ddf.groupby("A")["B"].transform(transformation),
2280 )
2281
2282
2283@pytest.mark.parametrize("npartitions", list(range(1, 10)))

Callers

nothing calls this directly

Calls 4

groupbyMethod · 0.95
assert_eqFunction · 0.90
transformMethod · 0.80
groupbyMethod · 0.45

Tested by

no test coverage detected