Adopt new pandas frequency codes #1534
Labels
bug
Something isn't working
enhancement
New feature or request
priority
Immediate priority
standards / conventions
Suggestions on ways forward
Milestone
Addressing a Problem?
Pandas has made changes to the frequency string codes, which will begin in version 2.2.
The first step is the introduction of a new set of default codes:
A
->Y
H
->h
T
->min
S
->s
(and so on for smaller periods)And the addition of the "E" suffix to denote a frequency anchored at the end of the period (instead of it being the default when not mentioned) (applies to Q, and M).
All the previous codes are now deprecated, but will be valid inputs for 2.2.
Potential Solution
If we change all the hardcoded codes to the new ones, we will need to pin pandas, so a temporary dynamic solution might be necessary (as done in xarray, but more complex).
I suggest a
ensure_correct_freq()
function that is called everywhere a frequency code is sent to xarray/pandas. The function will translate using the old or the new version depending on the installed version of pandas.Additional context
The function could be removed when we pin pandas >= 2.2 and all codes written with the new syntax.
xscen could make use of that function also, if needed.
See xarray issue, PR and links to the Pandas issues : pydata/xarray#8394
Contribution
Code of Conduct
The text was updated successfully, but these errors were encountered: