(dataset)
| 112 | |
| 113 | |
| 114 | def 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())]) |