Skip to content

Commit c779265

Browse files
committed
PERF: eliminate repeated get_option imports in period.pyx
1 parent ba1bc19 commit c779265

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pandas/_libs/tslibs/parsing.pyx

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ cdef set _not_datelike_strings = {'a', 'A', 'm', 'M', 'p', 'P', 't', 'T'}
4747

4848
# ----------------------------------------------------------------------
4949

50+
_get_option = None
51+
52+
def get_option(param):
53+
global _get_option
54+
if _get_option is None:
55+
from pandas.core.config import get_option
56+
_get_option = get_option
57+
return _get_option(param)
58+
5059

5160
def parse_datetime_string(date_string, freq=None, dayfirst=False,
5261
yearfirst=False, **kwargs):
@@ -117,7 +126,6 @@ def parse_time_string(arg, freq=None, dayfirst=None, yearfirst=None):
117126
freq = freq.rule_code
118127

119128
if dayfirst is None or yearfirst is None:
120-
from pandas.core.config import get_option
121129
if dayfirst is None:
122130
dayfirst = get_option("display.date_dayfirst")
123131
if yearfirst is None:

0 commit comments

Comments
 (0)