@@ -391,10 +391,10 @@ def test_unit_with_numeric(self):
391
391
arr1 = [1.434692e+18 , 1.432766e+18 ]
392
392
arr2 = np .array (arr1 ).astype ('int64' )
393
393
for errors in ['ignore' , 'raise' , 'coerce' ]:
394
- result = pd .to_datetime (arr1 , unit = units , errors = errors )
394
+ result = pd .to_datetime (arr1 , unit = 'ns' , errors = errors )
395
395
self .assert_index_equal (result , expected )
396
396
397
- result = pd .to_datetime (arr2 , unit = units , errors = errors )
397
+ result = pd .to_datetime (arr2 , unit = 'ns' , errors = errors )
398
398
self .assert_index_equal (result , expected )
399
399
400
400
# but we want to make sure that we are coercing
@@ -403,15 +403,15 @@ def test_unit_with_numeric(self):
403
403
'2015-06-19 05:33:20' ,
404
404
'2015-05-27 22:33:20' ])
405
405
arr = ['foo' , 1.434692e+18 , 1.432766e+18 ]
406
- result = pd .to_datetime (arr , unit = units , errors = 'coerce' )
406
+ result = pd .to_datetime (arr , unit = 'ns' , errors = 'coerce' )
407
407
self .assert_index_equal (result , expected )
408
408
409
409
expected = DatetimeIndex (['2015-06-19 05:33:20' ,
410
410
'2015-05-27 22:33:20' ,
411
411
'NaT' ,
412
412
'NaT' ])
413
413
arr = [1.434692e+18 , 1.432766e+18 , 'foo' , 'NaT' ]
414
- result = pd .to_datetime (arr , unit = units , errors = 'coerce' )
414
+ result = pd .to_datetime (arr , unit = 'ns' , errors = 'coerce' )
415
415
self .assert_index_equal (result , expected )
416
416
417
417
def test_unit_mixed (self ):
@@ -423,17 +423,17 @@ def test_unit_mixed(self):
423
423
self .assert_index_equal (result , expected )
424
424
425
425
with self .assertRaises (ValueError ):
426
- pd .to_datetime (arr , unit = units , errors = 'raise' )
426
+ pd .to_datetime (arr , unit = 'ns' , errors = 'raise' )
427
427
428
428
expected = DatetimeIndex (['NaT' ,
429
429
'NaT' ,
430
430
'2013-01-01' ])
431
431
arr = [1.434692e+18 , 1.432766e+18 , pd .Timestamp ('20130101' )]
432
- result = pd .to_datetime (arr , unit = units , errors = 'coerce' )
432
+ result = pd .to_datetime (arr , unit = 'ns' , errors = 'coerce' )
433
433
self .assert_index_equal (result , expected )
434
434
435
435
with self .assertRaises (ValueError ):
436
- pd .to_datetime (arr , unit = units , errors = 'raise' )
436
+ pd .to_datetime (arr , unit = 'ns' , errors = 'raise' )
437
437
438
438
def test_dataframe (self ):
439
439
0 commit comments