File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -366,6 +366,19 @@ def test_operation_on_NaT(self):
366
366
exp = pd .Series ([pd .NaT ], index = ["foo" ])
367
367
tm .assert_series_equal (res , exp )
368
368
369
+ def test_datetime_assignment_with_NaT_and_diff_time_units (self ):
370
+ # GH 7492
371
+ data_ns = np .array ([1 , 'nat' ], dtype = 'datetime64[ns]' )
372
+ result = pd .Series (data_ns ).to_frame ()
373
+ result ['new' ] = data_ns
374
+ expected = pd .DataFrame ({0 : data_ns , 'new' : data_ns })
375
+ tm .assert_frame_equal (result , expected )
376
+ # OutOfBoundsDatetime error shouldn't occur
377
+ data_s = np .array ([1 , 'nat' ], dtype = 'datetime64[s]' )
378
+ result ['new' ] = data_s
379
+ expected = pd .DataFrame ({0 : data_ns , 'new' : data_s })
380
+ tm .assert_frame_equal (result , expected )
381
+
369
382
370
383
if __name__ == '__main__' :
371
384
import nose
You can’t perform that action at this time.
0 commit comments