@@ -5,8 +5,6 @@ cimport numpy as cnp
55from numpy cimport int64_t, int32_t, intp_t, ndarray
66cnp.import_array()
77
8- from dateutil.tz import tzfile as _dateutil_tzfile
9-
108import pytz
119
1210# stdlib datetime imports
@@ -31,7 +29,7 @@ from pandas._libs.tslibs.util cimport (
3129from pandas._libs.tslibs.timedeltas cimport cast_from_unit
3230from pandas._libs.tslibs.timezones cimport (
3331 is_utc, is_tzlocal, is_fixed_offset, get_utcoffset, get_dst_info,
34- get_timezone, maybe_get_tz, tz_compare)
32+ get_timezone, maybe_get_tz, tz_compare, treat_tz_as_dateutil )
3533from pandas._libs.tslibs.timezones import UTC
3634from pandas._libs.tslibs.parsing import parse_datetime_string
3735
@@ -385,9 +383,8 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz,
385383 else :
386384 obj.value = pydatetime_to_dt64(ts, & obj.dts)
387385 # GH 24329 Take DST offset into account
388- # use dateutil.tz.tzfile to check type
389386 if ts.tzinfo is not None :
390- if isinstance (ts.tzinfo, _dateutil_tzfile ):
387+ if treat_tz_as_dateutil (ts.tzinfo):
391388 if ts.tzinfo.is_ambiguous(ts):
392389 dst_offset = ts.tzinfo.dst(ts)
393390 obj.value += int (dst_offset.total_seconds() * 1e9 )
0 commit comments