diff --git a/asv_bench/benchmarks/period.py b/asv_bench/benchmarks/period.py index fc34a47fee3e1..1af1ba1fb7b0b 100644 --- a/asv_bench/benchmarks/period.py +++ b/asv_bench/benchmarks/period.py @@ -43,6 +43,7 @@ class PeriodIndexConstructor(object): def setup(self, freq): self.rng = date_range('1985', periods=1000) self.rng2 = date_range('1985', periods=1000).to_pydatetime() + self.ints = list(range(2000, 3000)) def time_from_date_range(self, freq): PeriodIndex(self.rng, freq=freq) @@ -50,6 +51,9 @@ def time_from_date_range(self, freq): def time_from_pydatetime(self, freq): PeriodIndex(self.rng2, freq=freq) + def time_from_ints(self, freq): + PeriodIndex(self.ints, freq=freq) + class DataFramePeriodColumn(object): diff --git a/pandas/_libs/tslibs/parsing.pyx b/pandas/_libs/tslibs/parsing.pyx index 71bb8f79642dc..9a01bf378e549 100644 --- a/pandas/_libs/tslibs/parsing.pyx +++ b/pandas/_libs/tslibs/parsing.pyx @@ -118,12 +118,12 @@ def parse_time_string(arg, freq=None, dayfirst=None, yearfirst=None): if getattr(freq, "_typ", None) == "dateoffset": freq = freq.rule_code - if dayfirst is None: + if dayfirst is None or yearfirst is None: from pandas.core.config import get_option - dayfirst = get_option("display.date_dayfirst") - if yearfirst is None: - from pandas.core.config import get_option - yearfirst = get_option("display.date_yearfirst") + if dayfirst is None: + dayfirst = get_option("display.date_dayfirst") + if yearfirst is None: + yearfirst = get_option("display.date_yearfirst") res = parse_datetime_string_with_reso(arg, freq=freq, dayfirst=dayfirst,