@@ -346,17 +346,22 @@ class ToDatetime(object):
346
346
347
347
def setup (self ):
348
348
self .rng = date_range (start = '1/1/2000' , periods = 10000 , freq = 'D' )
349
- self .stringsD = Series (((( self .rng .year * 10000 ) + ( self . rng . month * 100 )) + self . rng . day ), dtype = np . int64 ). apply ( str )
349
+ self .stringsD = Series (self .rng .strftime ( '%Y%m%d' ) )
350
350
351
351
self .rng = date_range (start = '1/1/2000' , periods = 20000 , freq = 'H' )
352
- self .strings = [ x . strftime ('%Y-%m-%d %H:%M:%S' ) for x in self . rng ]
353
- self .strings_nosep = [ x . strftime ('%Y%m%d %H:%M:%S' ) for x in self . rng ]
352
+ self .strings = self . rng . strftime ('%Y-%m-%d %H:%M:%S' ). tolist ()
353
+ self .strings_nosep = self . rng . strftime ('%Y%m%d %H:%M:%S' ). tolist ()
354
354
self .strings_tz_space = [x .strftime ('%Y-%m-%d %H:%M:%S' ) + ' -0800'
355
355
for x in self .rng ]
356
356
357
357
self .s = Series ((['19MAY11' , '19MAY11:00:00:00' ] * 100000 ))
358
358
self .s2 = self .s .str .replace (':\\ S+$' , '' )
359
359
360
+ self .unique_numeric_seconds = range (10000 )
361
+ self .dup_numeric_seconds = [1000 ] * 10000
362
+ self .dup_string_dates = ['2000-02-11' ] * 10000
363
+ self .dup_string_with_tz = ['2000-02-11 15:00:00-0800' ] * 10000
364
+
360
365
def time_format_YYYYMMDD (self ):
361
366
to_datetime (self .stringsD , format = '%Y%m%d' )
362
367
@@ -381,6 +386,36 @@ def time_format_exact(self):
381
386
def time_format_no_exact (self ):
382
387
to_datetime (self .s , format = '%d%b%y' , exact = False )
383
388
389
+ def time_cache_true_with_unique_seconds_and_unit (self ):
390
+ to_datetime (self .unique_numeric_seconds , unit = 's' , cache = True )
391
+
392
+ def time_cache_false_with_unique_seconds_and_unit (self ):
393
+ to_datetime (self .unique_numeric_seconds , unit = 's' , cache = False )
394
+
395
+ def time_cache_true_with_dup_seconds_and_unit (self ):
396
+ to_datetime (self .dup_numeric_seconds , unit = 's' , cache = True )
397
+
398
+ def time_cache_false_with_dup_seconds_and_unit (self ):
399
+ to_datetime (self .dup_numeric_seconds , unit = 's' , cache = False )
400
+
401
+ def time_cache_true_with_dup_string_dates (self ):
402
+ to_datetime (self .dup_string_dates , cache = True )
403
+
404
+ def time_cache_false_with_dup_string_dates (self ):
405
+ to_datetime (self .dup_string_dates , cache = False )
406
+
407
+ def time_cache_true_with_dup_string_dates_and_format (self ):
408
+ to_datetime (self .dup_string_dates , format = '%Y-%m-%d' , cache = True )
409
+
410
+ def time_cache_false_with_dup_string_dates_and_format (self ):
411
+ to_datetime (self .dup_string_dates , format = '%Y-%m-%d' , cache = False )
412
+
413
+ def time_cache_true_with_dup_string_tzoffset_dates (self ):
414
+ to_datetime (self .dup_string_with_tz , cache = True )
415
+
416
+ def time_cache_false_with_dup_string_tzoffset_dates (self ):
417
+ to_datetime (self .dup_string_with_tz , cache = False )
418
+
384
419
385
420
class Offsets (object ):
386
421
goal_time = 0.2
0 commit comments