@@ -346,27 +346,21 @@ 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
- self .dup_numeric_data_10_5 = Series ([1000 ] * 100000 )
360
- self .dup_string_data_10_5 = ['2013-01-01 01:00:00' ] * 100000
361
- self .dup_datetime_data_10_5 = [dt .datetime (2010 , 1 , 1 )] * 100000
362
359
363
- self .dup_numeric_data_10_3 = Series ([1000 ] * 100 )
364
- self .dup_string_data_10_3 = ['2013-01-01 01:00:00' ] * 100
365
- self .dup_datetime_data_10_3 = [dt .datetime (2010 , 1 , 1 )] * 100
366
-
367
- self .dup_numeric_data_10_7 = Series ([1000 ] * 10 ** 7 )
368
- self .dup_string_data_10_7 = ['2013-01-01 01:00:00' ] * 10 ** 7
369
- self .dup_datetime_data_10_7 = [dt .datetime (2010 , 1 , 1 )] * 10 ** 7
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
370
364
371
365
def time_format_YYYYMMDD (self ):
372
366
to_datetime (self .stringsD , format = '%Y%m%d' )
@@ -392,32 +386,23 @@ def time_format_exact(self):
392
386
def time_format_no_exact (self ):
393
387
to_datetime (self .s , format = '%d%b%y' , exact = False )
394
388
395
- def time_cache_dup_numeric_data_10_3 (self ):
396
- to_datetime (self .dup_numeric_data_10_3 , unit = 's' )
397
-
398
- def time_cache_dup_datetime_data_10_3 (self ):
399
- to_datetime (self .dup_datetime_data_10_3 )
400
-
401
- def time_cache_dup_string_data_10_3 (self ):
402
- to_datetime (self .dup_string_data_10_3 )
403
-
404
- def time_cache_dup_numeric_data_10_5 (self ):
405
- to_datetime (self .dup_numeric_data_10_5 , unit = 's' )
389
+ def time_cache_with_unique_seconds_and unit (self ):
390
+ to_datetime (self .unique_numeric_seconds , unit = 's' )
406
391
407
- def time_cache_dup_datetime_data_10_5 (self ):
408
- to_datetime (self .dup_datetime_data_10_5 )
392
+ def time_cache_with_dup_seconds_and_unit (self ):
393
+ to_datetime (self .dup_numeric_seconds , unit = 's' )
409
394
410
- def time_cache_dup_string_data_10_5 (self ):
411
- to_datetime (self .dup_string_data_10_5 )
395
+ def time_cache_with_dup_string_dates (self ):
396
+ to_datetime (self .dup_string_dates )
412
397
413
- def time_cache_dup_numeric_data_10_7 (self ):
414
- to_datetime (self .dup_numeric_data_10_7 , unit = 's ' )
398
+ def time_cache_with_dup_string_dates_and_format (self ):
399
+ to_datetime (self .dup_string_dates , format = '%Y-%m-%d ' )
415
400
416
- def time_cache_dup_datetime_data_10_7 (self ):
417
- to_datetime (self .dup_datetime_data_10_7 )
401
+ def time_cache_with_dup_string_tzoffset_dates (self ):
402
+ to_datetime (self .dup_string_with_tz )
418
403
419
- def time_cache_dup_string_data_10_7 (self ):
420
- to_datetime (self .dup_string_data_10_7 )
404
+ def time_cache_with_dup_string_tzoffset_dates_and_format (self ):
405
+ to_datetim (self .dup_string_with_tz , format = '%Y-%m-%d %H:%M:%S%z' )
421
406
422
407
423
408
class Offsets (object ):
0 commit comments