| 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") |
| 1851 | fill_value = DataArray([0, 1], dims="y") |
| 1852 | actual = a.fillna(fill_value) |
| 1853 | expected = DataArray( |
| 1854 | [[0, 1], [1, 1], [0, 1], [3, 3]], coords={"x": range(4)}, dims=("x", "y") |
| 1855 | ) |
| 1856 | assert_identical(expected, actual) |
| 1857 | |
| 1858 | b = DataArray(range(4), coords={"x": range(4)}, dims="x") |
| 1859 | expected = b.copy() |
| 1860 | for target in [a, expected]: |
| 1861 | target.coords["b"] = ("x", [0, 0, 1, 1]) |
| 1862 | actual = a.groupby("b").fillna(DataArray([0, 2], dims="b")) |
| 1863 | assert_identical(expected, actual) |
| 1864 | |
| 1865 | @pytest.mark.parametrize("use_flox", [True, False]) |
| 1866 | def test_groupby_fastpath_for_monotonic(self, use_flox: bool) -> None: |