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

Method test_unstack_pandas_consistency

xarray/tests/test_dataarray.py:2814–2819  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2812 assert_identical(orig, actual)
2813
2814 def test_unstack_pandas_consistency(self) -> None:
2815 df = pd.DataFrame({"foo": range(3), "x": ["a", "b", "b"], "y": [0, 0, 1]})
2816 s = df.set_index(["x", "y"])["foo"]
2817 expected = DataArray(s.unstack(), name="foo")
2818 actual = DataArray(s, dims="z").unstack("z")
2819 assert_identical(expected, actual)
2820
2821 def test_unstack_requires_unique(self) -> None:
2822 df = pd.DataFrame({"foo": range(2), "x": ["a", "a"], "y": [0, 0]})

Callers

nothing calls this directly

Calls 4

DataArrayClass · 0.90
assert_identicalFunction · 0.90
set_indexMethod · 0.45
unstackMethod · 0.45

Tested by

no test coverage detected