MCPcopy
hub / github.com/pydata/xarray / test_multi_index_groupby_map

Function test_multi_index_groupby_map

xarray/tests/test_groupby.py:114–124  ·  view source on GitHub ↗
(dataset)

Source from the content-addressed store, hash-verified

112
113
114def test_multi_index_groupby_map(dataset) -> None:
115 # regression test for GH873
116 ds = dataset.isel(z=1, drop=True)[["foo"]]
117 expected = 2 * ds
118 actual = (
119 ds.stack(space=["x", "y"])
120 .groupby("space")
121 .map(lambda x: 2 * x)
122 .unstack("space")
123 )
124 assert_equal(expected, actual)
125
126
127@pytest.mark.parametrize("grouper", [dict(group="x"), dict(x=UniqueGrouper())])

Callers

nothing calls this directly

Calls 6

assert_equalFunction · 0.90
iselMethod · 0.45
unstackMethod · 0.45
mapMethod · 0.45
groupbyMethod · 0.45
stackMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…