@@ -183,7 +183,7 @@ def test_to_datetime_format_YYYYMMDD_ignore_with_outofbounds(self, cache):
183
183
errors = "ignore" ,
184
184
cache = cache ,
185
185
)
186
- expected = Index (["15010101" , "20150101" , np .nan ])
186
+ expected = Index (["15010101" , "20150101" , np .nan ], dtype = object )
187
187
tm .assert_index_equal (result , expected )
188
188
189
189
def test_to_datetime_format_YYYYMMDD_coercion (self , cache ):
@@ -1206,7 +1206,9 @@ def test_out_of_bounds_errors_ignore2(self):
1206
1206
# GH#12424
1207
1207
msg = "errors='ignore' is deprecated"
1208
1208
with tm .assert_produces_warning (FutureWarning , match = msg ):
1209
- res = to_datetime (Series (["2362-01-01" , np .nan ]), errors = "ignore" )
1209
+ res = to_datetime (
1210
+ Series (["2362-01-01" , np .nan ], dtype = object ), errors = "ignore"
1211
+ )
1210
1212
exp = Series (["2362-01-01" , np .nan ], dtype = object )
1211
1213
tm .assert_series_equal (res , exp )
1212
1214
@@ -1489,7 +1491,7 @@ def test_datetime_invalid_index(self, values, format):
1489
1491
warn , match = "Could not infer format" , raise_on_extra_warnings = False
1490
1492
):
1491
1493
res = to_datetime (values , errors = "ignore" , format = format )
1492
- tm .assert_index_equal (res , Index (values ))
1494
+ tm .assert_index_equal (res , Index (values , dtype = object ))
1493
1495
1494
1496
with tm .assert_produces_warning (
1495
1497
warn , match = "Could not infer format" , raise_on_extra_warnings = False
@@ -1667,7 +1669,7 @@ def test_to_datetime_coerce_oob(self, string_arg, format, outofbounds):
1667
1669
"errors, expected" ,
1668
1670
[
1669
1671
("coerce" , Index ([NaT , NaT ])),
1670
- ("ignore" , Index (["200622-12-31" , "111111-24-11" ])),
1672
+ ("ignore" , Index (["200622-12-31" , "111111-24-11" ], dtype = object )),
1671
1673
],
1672
1674
)
1673
1675
def test_to_datetime_malformed_no_raise (self , errors , expected ):
@@ -2681,7 +2683,7 @@ def test_string_na_nat_conversion_malformed(self, cache):
2681
2683
2682
2684
result = to_datetime (malformed , errors = "ignore" , cache = cache )
2683
2685
# GH 21864
2684
- expected = Index (malformed )
2686
+ expected = Index (malformed , dtype = object )
2685
2687
tm .assert_index_equal (result , expected )
2686
2688
2687
2689
with pytest .raises (ValueError , match = msg ):
@@ -3670,7 +3672,7 @@ def test_to_datetime_mixed_not_necessarily_iso8601_raise():
3670
3672
("errors" , "expected" ),
3671
3673
[
3672
3674
("coerce" , DatetimeIndex (["2020-01-01 00:00:00" , NaT ])),
3673
- ("ignore" , Index (["2020-01-01" , "01-01-2000" ])),
3675
+ ("ignore" , Index (["2020-01-01" , "01-01-2000" ], dtype = object )),
3674
3676
],
3675
3677
)
3676
3678
def test_to_datetime_mixed_not_necessarily_iso8601_coerce (errors , expected ):
0 commit comments