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

Method test_groupby_bins_sort

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

Source from the content-addressed store, hash-verified

1827 assert_identical(actual, expected)
1828
1829 def test_groupby_bins_sort(self) -> None:
1830 data = xr.DataArray(
1831 np.arange(100), dims="x", coords={"x": np.linspace(-100, 100, num=100)}
1832 )
1833 binned_mean = data.groupby_bins("x", bins=11).mean()
1834 assert binned_mean.to_index().is_monotonic_increasing
1835
1836 with xr.set_options(use_flox=True):
1837 actual = data.groupby_bins("x", bins=11).count()
1838 with xr.set_options(use_flox=False):
1839 expected = data.groupby_bins("x", bins=11).count()
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")

Callers

nothing calls this directly

Calls 7

groupby_binsMethod · 0.95
assert_identicalFunction · 0.90
arangeMethod · 0.80
linspaceMethod · 0.80
meanMethod · 0.45
to_indexMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected