@@ -92,6 +92,8 @@ def get_freq_code(freqstr):
92
92
code = _period_str_to_code (freqstr [0 ])
93
93
stride = freqstr [1 ]
94
94
except :
95
+ if com .is_integer (freqstr [1 ]):
96
+ raise
95
97
code = _period_str_to_code (freqstr [1 ])
96
98
stride = freqstr [0 ]
97
99
return code , stride
@@ -367,9 +369,27 @@ def get_period_alias(offset_str):
367
369
368
370
for _i , _weekday in enumerate (['MON' , 'TUE' , 'WED' , 'THU' , 'FRI' ]):
369
371
for _iweek in range (4 ):
372
+ offset = offsets .WeekOfMonth (week = _iweek , weekday = _i )
373
+ #TODO: Read the _name from offset.rule_code
370
374
_name = 'WOM-%d%s' % (_iweek + 1 , _weekday )
371
- _offset_map [_name ] = offsets . WeekOfMonth ( week = _iweek , weekday = _i )
375
+ _offset_map [_name ] = offset
372
376
_rule_aliases [_name .replace ('-' , '@' )] = _name
377
+
378
+ def add_offset_to_map (offset ):
379
+ _name = offset .rule_code
380
+ _offset_map [_name ] = offset
381
+
382
+ for _weekday in range (7 ):
383
+ for _imonth in range (1 ,12 + 1 ):
384
+
385
+ for cls in [offsets .FY5253LastOfMonth , offsets .FY5253NearestEndMonth ]:
386
+ offset = cls (startingMonth = _imonth , weekday = _weekday )
387
+ add_offset_to_map (offset )
388
+
389
+ for qtr_with_extra_week in range (1 ,4 + 1 ):
390
+ for cls in [offsets .FY5253LastOfMonthQuarter , offsets .FY5253NearestEndMonthQuarter ]:
391
+ offset = cls (startingMonth = _imonth , weekday = _weekday , qtr_with_extra_week = qtr_with_extra_week )
392
+ add_offset_to_map (offset )
373
393
374
394
# Note that _rule_aliases is not 1:1 (d[BA]==d[A@DEC]), and so traversal
375
395
# order matters when constructing an inverse. we pick one. #2331
@@ -542,9 +562,6 @@ def get_legacy_offset_name(offset):
542
562
name = _offset_names .get (offset )
543
563
return _legacy_reverse_map .get (name , name )
544
564
545
- get_offset_name = get_offset_name
546
-
547
-
548
565
def get_standard_freq (freq ):
549
566
"""
550
567
Return the standardized frequency string
@@ -744,7 +761,7 @@ def _period_str_to_code(freqstr):
744
761
try :
745
762
freqstr = freqstr .upper ()
746
763
return _period_code_map [freqstr ]
747
- except :
764
+ except KeyError :
748
765
alias = _period_alias_dict [freqstr ]
749
766
return _period_code_map [alias ]
750
767
0 commit comments