Skip to content

Commit

Permalink
Fix asv errors and condition
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Sep 26, 2017
1 parent 89ce37f commit 72e99da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
15 changes: 6 additions & 9 deletions asv_bench/benchmarks/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,23 +386,20 @@ def time_format_exact(self):
def time_format_no_exact(self):
to_datetime(self.s, format='%d%b%y', exact=False)

def time_cache_with_unique_seconds_and unit(self):
to_datetime(self.unique_numeric_seconds, unit='s')
def time_cache_with_unique_seconds_and_unit(self):
to_datetime(self.unique_numeric_seconds, unit='s')

def time_cache_with_dup_seconds_and_unit(self):
to_datetime(self.dup_numeric_seconds, unit='s')
to_datetime(self.dup_numeric_seconds, unit='s')

def time_cache_with_dup_string_dates(self):
to_datetime(self.dup_string_dates)
to_datetime(self.dup_string_dates)

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

def time_cache_with_dup_string_tzoffset_dates(self):
to_datetime(self.dup_string_with_tz)

def time_cache_with_dup_string_tzoffset_dates_and_format(self):
to_datetim(self.dup_string_with_tz, format='%Y-%m-%d %H:%M:%S%z')
to_datetime(self.dup_string_with_tz)


class Offsets(object):
Expand Down
13 changes: 6 additions & 7 deletions pandas/core/tools/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,12 @@ def _convert_listlike(arg, box, format, name=None, tz=tz):
arg = arg + offset

convert_cache = None
if cache and is_list_like(arg):
if len(arg) >= 1000:
unique_dates = algorithms.unique(arg)
if len(unique_dates) != len(arg):
from pandas import Series
cache_dates = _convert_listlike(unique_dates, False, format)
convert_cache = Series(cache_dates, index=unique_dates)
if cache and is_list_like(arg) and len(arg) >= 1000:
unique_dates = algorithms.unique(arg)
if len(unique_dates) != len(arg):
from pandas import Series
cache_dates = _convert_listlike(unique_dates, False, format)
convert_cache = Series(cache_dates, index=unique_dates)

if isinstance(arg, tslib.Timestamp):
result = arg
Expand Down

0 comments on commit 72e99da

Please sign in to comment.