Skip to content

New benchmarks for parsing dates with dayfirst=True and format='%d-%m-%Y' #26360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
rollback first benchmarks
  • Loading branch information
anmyachev committed May 14, 2019
commit e33284d0f3db92d70854751e4b95b7ee507d1f15
10 changes: 5 additions & 5 deletions asv_bench/benchmarks/io/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,22 @@ def mem_parser_chunks(self):


class ReadCSVParseSpecialDate(StringIORewind):
params = (['mY', 'mdY', 'hm'], [False, True])
param_names = ['value', 'dayfirst']
params = (['mY', 'mdY', 'hm'],)
param_names = ['value']
objects = {
'mY': '01-2019\n10-2019\n02/2000\n',
'mdY': '12/02/2010\n',
'hm': '21:34\n'
}

def setup(self, value, dayfirst):
def setup(self, value):
count_elem = 10000
data = self.objects[value] * count_elem
self.StringIO_input = StringIO(data)

def time_read_special_date(self, value, dayfirst):
def time_read_special_date(self, value):
read_csv(self.data(self.StringIO_input), sep=',', header=None,
names=['Date'], parse_dates=['Date'], dayfirst=dayfirst)
names=['Date'], parse_dates=['Date'])


class ParseDateComparison(StringIORewind):
Expand Down
6 changes: 1 addition & 5 deletions asv_bench/benchmarks/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,19 +354,15 @@ def time_infer_quarter(self):
class ToDatetimeFormat:

def setup(self):
self.count = 100000
self.s = Series(['19MAY11', '19MAY11:00:00:00'] * self.count)
self.s = Series(['19MAY11', '19MAY11:00:00:00'] * 100000)
self.s2 = self.s.str.replace(':\\S+$', '')
self.s3 = Series(['02-11-2000'] * self.count)

def time_exact(self):
to_datetime(self.s2, format='%d%b%y')

def time_no_exact(self):
to_datetime(self.s, format='%d%b%y', exact=False)

def time_DDMMYYYY(self):
to_datetime(self.s3, format='%d-%m-%Y')

class ToDatetimeCache:

Expand Down