Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions asv_bench/benchmarks/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ 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)

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):

Expand Down
10 changes: 5 additions & 5 deletions pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down