@@ -255,7 +255,6 @@ def test_to_datetime_format_YYYYMMDD_with_none(self, input_s):
255255 def test_to_datetime_format_YYYYMMDD_overflow (self , input_s , expected ):
256256 # GH 25512
257257 # format='%Y%m%d', errors='coerce'
258- # expected = expected.dt.as_unit("ns")
259258 result = to_datetime (input_s , format = "%Y%m%d" , errors = "coerce" )
260259 tm .assert_series_equal (result , expected )
261260
@@ -277,7 +276,6 @@ def test_to_datetime_format_YYYYMMDD_overflow(self, input_s, expected):
277276 )
278277 def test_to_datetime_with_NA (self , data , format , expected ):
279278 # GH#42957
280- # expected = expected.as_unit("ns")
281279 result = to_datetime (data , format = format )
282280 tm .assert_index_equal (result , expected )
283281
@@ -494,7 +492,7 @@ def test_to_datetime_format_weeks(self, value, fmt, expected, cache):
494492 def test_to_datetime_parse_tzname_or_tzoffset (self , fmt , dates , expected_dates ):
495493 # GH 13486
496494 result = to_datetime (dates , format = fmt )
497- expected = Index (expected_dates ) # .as_unit("ns")
495+ expected = Index (expected_dates )
498496 tm .assert_equal (result , expected )
499497
500498 @pytest .mark .parametrize (
@@ -554,7 +552,7 @@ def test_to_datetime_parse_tzname_or_tzoffset_different_tz_to_utc(self):
554552 fmt = "%Y-%m-%d %H:%M:%S %z"
555553
556554 result = to_datetime (dates , format = fmt , utc = True )
557- expected = DatetimeIndex (expected_dates ) # .as_unit("ns")
555+ expected = DatetimeIndex (expected_dates )
558556 tm .assert_index_equal (result , expected )
559557
560558 @pytest .mark .parametrize (
@@ -580,9 +578,7 @@ def test_to_datetime_parse_timezone_keeps_name(self):
580578 fmt = "%Y-%m-%d %H:%M:%S %z"
581579 arg = Index (["2010-01-01 12:00:00 Z" ], name = "foo" )
582580 result = to_datetime (arg , format = fmt )
583- expected = DatetimeIndex (
584- ["2010-01-01 12:00:00" ], tz = "UTC" , name = "foo"
585- ) # .as_unit("ns")
581+ expected = DatetimeIndex (["2010-01-01 12:00:00" ], tz = "UTC" , name = "foo" )
586582 tm .assert_index_equal (result , expected )
587583
588584
@@ -615,9 +611,7 @@ def test_to_datetime_mixed_datetime_and_string(self):
615611 d1 = datetime (2020 , 1 , 1 , 17 , tzinfo = timezone (- timedelta (hours = 1 )))
616612 d2 = datetime (2020 , 1 , 1 , 18 , tzinfo = timezone (- timedelta (hours = 1 )))
617613 res = to_datetime (["2020-01-01 17:00 -0100" , d2 ])
618- expected = to_datetime ([d1 , d2 ]).tz_convert (
619- timezone (timedelta (minutes = - 60 ))
620- ) # .as_unit("ns")
614+ expected = to_datetime ([d1 , d2 ]).tz_convert (timezone (timedelta (minutes = - 60 )))
621615 tm .assert_index_equal (res , expected )
622616
623617 def test_to_datetime_mixed_string_and_numeric (self ):
@@ -1140,7 +1134,7 @@ def test_to_datetime_dt64s(self, cache, dt):
11401134 def test_to_datetime_dt64s_and_str (self , arg , format ):
11411135 # https://github.com/pandas-dev/pandas/issues/50036
11421136 result = to_datetime ([arg , np .datetime64 ("2020-01-01" )], format = format )
1143- expected = DatetimeIndex (["2001-01-01" , "2020-01-01" ]) # .as_unit("ns")
1137+ expected = DatetimeIndex (["2001-01-01" , "2020-01-01" ])
11441138 tm .assert_index_equal (result , expected )
11451139
11461140 @pytest .mark .parametrize (
@@ -1736,11 +1730,11 @@ def test_iso_8601_strings_with_same_offset(self):
17361730 expected = Timestamp (ts_str )
17371731 assert result == expected
17381732
1739- expected = DatetimeIndex ([Timestamp (ts_str )] * 2 ) # .as_unit("ns")
1733+ expected = DatetimeIndex ([Timestamp (ts_str )] * 2 )
17401734 result = to_datetime ([ts_str ] * 2 )
17411735 tm .assert_index_equal (result , expected )
17421736
1743- result = DatetimeIndex ([ts_str ] * 2 ) # .as_unit("ns")
1737+ result = DatetimeIndex ([ts_str ] * 2 )
17441738 tm .assert_index_equal (result , expected )
17451739
17461740 def test_iso_8601_strings_with_different_offsets (self ):
@@ -3703,9 +3697,7 @@ def test_to_datetime_format_f_parse_nanos():
37033697def test_to_datetime_mixed_iso8601 ():
37043698 # https://github.com/pandas-dev/pandas/issues/50411
37053699 result = to_datetime (["2020-01-01" , "2020-01-01 05:00:00" ], format = "ISO8601" )
3706- expected = DatetimeIndex (
3707- ["2020-01-01 00:00:00" , "2020-01-01 05:00:00" ]
3708- ) # .as_unit("ns")
3700+ expected = DatetimeIndex (["2020-01-01 00:00:00" , "2020-01-01 05:00:00" ])
37093701 tm .assert_index_equal (result , expected )
37103702
37113703
@@ -3774,13 +3766,12 @@ def test_to_datetime_with_empty_str_utc_false_format_mixed():
37743766 # GH 50887
37753767 vals = ["2020-01-01 00:00+00:00" , "" ]
37763768 result = to_datetime (vals , format = "mixed" )
3777- expected = Index ([Timestamp ("2020-01-01 00:00+00:00" ), "NaT" ], dtype = "M8[ns , UTC]" )
3769+ expected = Index ([Timestamp ("2020-01-01 00:00+00:00" ), "NaT" ], dtype = "M8[s , UTC]" )
37783770 tm .assert_index_equal (result , expected )
37793771
37803772 # Check that a couple of other similar paths work the same way
3781- # FIXME: expect the same reso!
37823773 alt = to_datetime (vals )
3783- tm .assert_index_equal (alt , expected . as_unit ( "s" ) )
3774+ tm .assert_index_equal (alt , expected )
37843775 alt2 = DatetimeIndex (vals )
37853776 tm .assert_index_equal (alt2 , expected )
37863777
0 commit comments