diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 3364087143b..14377792f0d 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -28,7 +28,7 @@ Breaking changes - Following pandas, :py:meth:`infer_freq` will return ``"YE"``, instead of ``"Y"`` (formerly ``"A"``). This is to be consistent with the deprecation of the latter frequency string in pandas 2.2. - This is a follow up to :pull:`8415` (:issue:`8612`, :pull:`8629`). + This is a follow up to :pull:`8415` (:issue:`8612`, :pull:`8642`). By `Mathias Hauser `_. Deprecations diff --git a/xarray/coding/frequencies.py b/xarray/coding/frequencies.py index c401fb95f1c..341627ab114 100644 --- a/xarray/coding/frequencies.py +++ b/xarray/coding/frequencies.py @@ -183,7 +183,7 @@ def _get_annual_rule(self): if len(np.unique(self.index.month)) > 1: return None - return {"cs": "YS", "ce": "Y"}.get(month_anchor_check(self.index)) + return {"cs": "YS", "ce": "YE"}.get(month_anchor_check(self.index)) def _get_quartely_rule(self): if len(self.month_deltas) > 1: diff --git a/xarray/tests/test_cftimeindex.py b/xarray/tests/test_cftimeindex.py index 062756e614b..6f0e00ef5bb 100644 --- a/xarray/tests/test_cftimeindex.py +++ b/xarray/tests/test_cftimeindex.py @@ -1353,7 +1353,7 @@ def test_infer_freq_invalid_inputs(): "freq", [ "300YS-JAN", - "Y-DEC", + "YE-DEC", "YS-JUL", "2YS-FEB", "QE-NOV",