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

Method test_groupby_assign_coords

xarray/tests/test_groupby.py:1842–1847  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1840 assert_identical(actual, expected)
1841
1842 def test_groupby_assign_coords(self) -> None:
1843 array = DataArray([1, 2, 3, 4], {"c": ("x", [0, 0, 1, 1])}, dims="x")
1844 actual = array.groupby("c").assign_coords(d=lambda a: a.mean())
1845 expected = array.copy()
1846 expected.coords["d"] = ("x", [1.5, 1.5, 3.5, 3.5])
1847 assert_identical(actual, expected)
1848
1849 def test_groupby_fillna(self) -> None:
1850 a = DataArray([np.nan, 1, np.nan, 3], coords={"x": range(4)}, dims="x")

Callers

nothing calls this directly

Calls 6

groupbyMethod · 0.95
copyMethod · 0.95
DataArrayClass · 0.90
assert_identicalFunction · 0.90
assign_coordsMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected