File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,25 @@ def test_to_datetime_parse_timezone_keeps_name(self):
544544
545545
546546class TestToDatetime :
547+ def test_to_datetime_mixed_string_resos (self ):
548+ # GH#62801
549+ vals = [
550+ "2016-01-01 01:02:03" ,
551+ "2016-01-01 01:02:03.001" ,
552+ "2016-01-01 01:02:03.001002" ,
553+ "2016-01-01 01:02:03.001002003" ,
554+ ]
555+ expected = DatetimeIndex ([Timestamp (x ).as_unit ("ns" ) for x in vals ])
556+
557+ result1 = DatetimeIndex (vals )
558+ tm .assert_index_equal (result1 , expected )
559+
560+ result2 = to_datetime (vals , format = "ISO8601" )
561+ tm .assert_index_equal (result2 , expected )
562+
563+ result3 = to_datetime (vals , format = "mixed" )
564+ tm .assert_index_equal (result3 , expected )
565+
547566 def test_to_datetime_none (self ):
548567 # GH#23055
549568 assert to_datetime (None ) is NaT
You can’t perform that action at this time.
0 commit comments