File tree 1 file changed +5
-9
lines changed
1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -912,19 +912,15 @@ def try_datetime(v):
912
912
913
913
# we might have a sequence of the same-datetimes with tz's
914
914
# if so coerce to a DatetimeIndex; if they are not the same,
915
- # then these stay as object dtype
916
-
917
- # GH19671
918
- # replaced to_datetime call with
919
- # tslibs.conversion.datetime_to_datetime64
920
- # in order to avoid changes to public to_datetime API
915
+ # then these stay as object dtype, xref GH19671
921
916
try :
922
917
from pandas ._libs .tslibs import conversion
923
- from pandas . core . indexes . datetimes import DatetimeIndex
918
+ from pandas import DatetimeIndex
924
919
925
920
values , tz = conversion .datetime_to_datetime64 (v )
926
- return DatetimeIndex ._simple_new (values , tz = tz )
927
- except Exception :
921
+ return DatetimeIndex (values ).tz_localize (
922
+ 'UTC' ).tz_convert (tz = tz )
923
+ except (ValueError , TypeError ):
928
924
pass
929
925
930
926
except Exception :
You can’t perform that action at this time.
0 commit comments