Skip to content

Commit d833baa

Browse files
author
Iva Miholic
committed
Add a pure_alias dict containing Y->A
1 parent ca26042 commit d833baa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pandas/tseries/frequencies.py

+22
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,27 @@ def get_period_alias(offset_str):
422422
return _offset_to_period_map.get(offset_str, None)
423423

424424

425+
_pure_alias = {
426+
# 'A' is equivalent to 'Y'.
427+
'Y': 'A',
428+
'YS': 'AS',
429+
'BY': 'BA',
430+
'BYS': 'BAS',
431+
'Y-DEC': 'A-DEC',
432+
'Y-JAN': 'A-JAN',
433+
'Y-FEB': 'A-FEB',
434+
'Y-MAR': 'A-MAR',
435+
'Y-APR': 'A-APR',
436+
'Y-MAY': 'A-MAY',
437+
'Y-JUN': 'A-JUN',
438+
'Y-JUL': 'A-JUL',
439+
'Y-AUG': 'A-AUG',
440+
'Y-SEP': 'A-SEP',
441+
'Y-OCT': 'A-OCT',
442+
'Y-NOV': 'A-NOV',
443+
}
444+
445+
425446
_lite_rule_alias = {
426447
'W': 'W-SUN',
427448
'Q': 'Q-DEC',
@@ -718,6 +739,7 @@ def get_standard_freq(freq):
718739

719740

720741
def _period_str_to_code(freqstr):
742+
freqstr = _pure_alias.get(freqstr, freqstr)
721743
freqstr = _lite_rule_alias.get(freqstr, freqstr)
722744

723745
if freqstr not in _dont_uppercase:

0 commit comments

Comments
 (0)