@@ -1225,40 +1225,6 @@ def test_iso_8601_strings_with_different_offsets_utc(self):
12251225 )
12261226 tm .assert_index_equal (result , expected )
12271227
1228- def test_iso8601_strings_mixed_offsets_with_naive (self ):
1229- # GH 24992
1230- # Can't parse consistently, need to parse each element in loop.
1231- result = DatetimeIndex (
1232- [
1233- to_datetime (string , utc = True )
1234- for string in [
1235- "2018-11-28T00:00:00" ,
1236- "2018-11-28T00:00:00+12:00" ,
1237- "2018-11-28T00:00:00" ,
1238- "2018-11-28T00:00:00+06:00" ,
1239- "2018-11-28T00:00:00" ,
1240- ]
1241- ]
1242- )
1243- expected = to_datetime (
1244- [
1245- "2018-11-28T00:00:00" ,
1246- "2018-11-27T12:00:00" ,
1247- "2018-11-28T00:00:00" ,
1248- "2018-11-27T18:00:00" ,
1249- "2018-11-28T00:00:00" ,
1250- ],
1251- utc = True ,
1252- )
1253- tm .assert_index_equal (result , expected )
1254-
1255- def test_iso8601_strings_mixed_offsets_with_naive_reversed (self ):
1256- items = ["2018-11-28T00:00:00+12:00" , "2018-11-28T00:00:00" ]
1257- # Can't parse consistently, need to parse each element in loop.
1258- result = [to_datetime (item , utc = True ) for item in items ]
1259- expected = [to_datetime (item , utc = True ) for item in list (reversed (items ))][::- 1 ]
1260- assert result == expected
1261-
12621228 def test_mixed_offsets_with_native_datetime_raises (self ):
12631229 # GH 25978
12641230
@@ -1910,9 +1876,7 @@ def test_to_datetime_overflow(self):
19101876 def test_string_na_nat_conversion (self , cache ):
19111877 # GH #999, #858
19121878
1913- strings = np .array (
1914- ["1/1/2000" , "1/2/2000" , np .nan , "1/4/2000, 12:34:56" ], dtype = object
1915- )
1879+ strings = np .array (["1/1/2000" , "1/2/2000" , np .nan , "1/4/2000" ], dtype = object )
19161880
19171881 expected = np .empty (4 , dtype = "M8[ns]" )
19181882 for i , val in enumerate (strings ):
@@ -1924,10 +1888,7 @@ def test_string_na_nat_conversion(self, cache):
19241888 result = tslib .array_to_datetime (strings )[0 ]
19251889 tm .assert_almost_equal (result , expected )
19261890
1927- # Can't parse in consistent format, so need to convert each individually.
1928- result2 = DatetimeIndex (
1929- [to_datetime (string , cache = cache ) for string in strings ]
1930- )
1891+ result2 = to_datetime (strings , cache = cache )
19311892 assert isinstance (result2 , DatetimeIndex )
19321893 tm .assert_numpy_array_equal (result , result2 .values )
19331894
0 commit comments