@@ -37,6 +37,7 @@ from pandas._config import get_option
37
37
from pandas._libs.tslibs.ccalendar import MONTH_NUMBERS
38
38
from pandas._libs.tslibs.nattype import nat_strings, NaT
39
39
from pandas._libs.tslibs.util cimport is_array, get_c_string_buf_and_size
40
+ from pandas._libs.tslibs.frequencies cimport get_rule_month
40
41
41
42
cdef extern from " ../src/headers/portable.h" :
42
43
int getdigit_ascii(char c, int default) nogil
@@ -429,7 +430,7 @@ cdef inline object _parse_dateabbr_string(object date_string, object default,
429
430
if freq is not None :
430
431
# hack attack, #1228
431
432
try :
432
- mnum = MONTH_NUMBERS[_get_rule_month (freq)] + 1
433
+ mnum = MONTH_NUMBERS[get_rule_month (freq)] + 1
433
434
except (KeyError , ValueError ):
434
435
raise DateParseError(f' Unable to retrieve month '
435
436
f' information from given '
@@ -469,7 +470,7 @@ cdef inline object _parse_dateabbr_string(object date_string, object default,
469
470
raise ValueError (f' Unable to parse {date_string}' )
470
471
471
472
472
- cdef dateutil_parse(object timestr, object default, ignoretz = False ,
473
+ cdef dateutil_parse(str timestr, object default, ignoretz = False ,
473
474
tzinfos = None , dayfirst = None , yearfirst = None ):
474
475
""" lifted from dateutil to get resolution"""
475
476
@@ -532,28 +533,6 @@ cdef dateutil_parse(object timestr, object default, ignoretz=False,
532
533
return ret, reso
533
534
534
535
535
- cdef str _get_rule_month(object source):
536
- """
537
- Return starting month of given freq, default is December.
538
-
539
- Example
540
- -------
541
- >>> _get_rule_month('D')
542
- 'DEC'
543
-
544
- >>> _get_rule_month('A-JAN')
545
- 'JAN'
546
- """
547
- if hasattr (source, ' freqstr' ):
548
- source = source.freqstr
549
- source = source.upper()
550
- if ' -' not in source:
551
- # Default is December
552
- return " DEC"
553
- else :
554
- return source.split(' -' )[1 ]
555
-
556
-
557
536
# ----------------------------------------------------------------------
558
537
# Parsing for type-inference
559
538
0 commit comments