MCPcopy Index your code
hub / github.com/pydata/xarray / test_stack_unstack_fast

Method test_stack_unstack_fast

xarray/tests/test_dataset.py:4292–4305  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4290 assert_equal(expected3, actual3)
4291
4292 def test_stack_unstack_fast(self) -> None:
4293 ds = Dataset(
4294 {
4295 "a": ("x", [0, 1]),
4296 "b": (("x", "y"), [[0, 1], [2, 3]]),
4297 "x": [0, 1],
4298 "y": ["a", "b"],
4299 }
4300 )
4301 actual = ds.stack(z=["x", "y"]).unstack("z")
4302 assert actual.broadcast_equals(ds)
4303
4304 actual = ds[["b"]].stack(z=["x", "y"]).unstack("z")
4305 assert actual.identical(ds[["b"]])
4306
4307 def test_stack_unstack_slow(self) -> None:
4308 ds = Dataset(

Callers

nothing calls this directly

Calls 6

stackMethod · 0.95
DatasetClass · 0.90
unstackMethod · 0.45
broadcast_equalsMethod · 0.45
stackMethod · 0.45
identicalMethod · 0.45

Tested by

no test coverage detected