Skip to content

Commit a6962aa

Browse files
author
Iva Miholic
committed
Add a pure_alias dict containing Y->A
1 parent 8e79832 commit a6962aa

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pandas/tseries/frequencies.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,26 @@ def get_period_alias(offset_str):
421421
""" alias to closest period strings BQ->Q etc"""
422422
return _offset_to_period_map.get(offset_str, None)
423423

424+
_pure_alias = {
425+
# 'A' is equivalent to 'Y'.
426+
'Y': 'A',
427+
'YS': 'AS',
428+
'BY': 'BA',
429+
'BYS': 'BAS',
430+
'Y-DEC': 'A-DEC',
431+
'Y-JAN': 'A-JAN',
432+
'Y-FEB': 'A-FEB',
433+
'Y-MAR': 'A-MAR',
434+
'Y-APR': 'A-APR',
435+
'Y-MAY': 'A-MAY',
436+
'Y-JUN': 'A-JUN',
437+
'Y-JUL': 'A-JUL',
438+
'Y-AUG': 'A-AUG',
439+
'Y-SEP': 'A-SEP',
440+
'Y-OCT': 'A-OCT',
441+
'Y-NOV': 'A-NOV',
442+
}
443+
424444

425445
_lite_rule_alias = {
426446
'W': 'W-SUN',
@@ -718,6 +738,7 @@ def get_standard_freq(freq):
718738

719739

720740
def _period_str_to_code(freqstr):
741+
freqstr = _pure_alias.get(freqstr, freqstr)
721742
freqstr = _lite_rule_alias.get(freqstr, freqstr)
722743

723744
if freqstr not in _dont_uppercase:

0 commit comments

Comments
 (0)