Skip to content

Commit

Permalink
infer_freq: return 'YE' (#8629 follow-up) (#8642)
Browse files Browse the repository at this point in the history
* infer_freq: return 'YE' (#8629 follow-up)

* fix whats new

---------

Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
  • Loading branch information
mathause and max-sixty authored Jan 23, 2024
1 parent 4b5c87b commit 4bb5175
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/mathause>`_.

Deprecations
Expand Down
2 changes: 1 addition & 1 deletion xarray/coding/frequencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion xarray/tests/test_cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ def test_infer_freq_invalid_inputs():
"freq",
[
"300YS-JAN",
"Y-DEC",
"YE-DEC",
"YS-JUL",
"2YS-FEB",
"QE-NOV",
Expand Down

0 comments on commit 4bb5175

Please sign in to comment.