@@ -1225,40 +1225,6 @@ def test_iso_8601_strings_with_different_offsets_utc(self):
1225
1225
)
1226
1226
tm .assert_index_equal (result , expected )
1227
1227
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
-
1262
1228
def test_mixed_offsets_with_native_datetime_raises (self ):
1263
1229
# GH 25978
1264
1230
@@ -1910,9 +1876,7 @@ def test_to_datetime_overflow(self):
1910
1876
def test_string_na_nat_conversion (self , cache ):
1911
1877
# GH #999, #858
1912
1878
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 )
1916
1880
1917
1881
expected = np .empty (4 , dtype = "M8[ns]" )
1918
1882
for i , val in enumerate (strings ):
@@ -1924,10 +1888,7 @@ def test_string_na_nat_conversion(self, cache):
1924
1888
result = tslib .array_to_datetime (strings )[0 ]
1925
1889
tm .assert_almost_equal (result , expected )
1926
1890
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 )
1931
1892
assert isinstance (result2 , DatetimeIndex )
1932
1893
tm .assert_numpy_array_equal (result , result2 .values )
1933
1894
0 commit comments