@@ -5,8 +5,6 @@ cimport numpy as cnp
5
5
from numpy cimport int64_t, int32_t, intp_t, ndarray
6
6
cnp.import_array()
7
7
8
- from dateutil.tz import tzfile as _dateutil_tzfile
9
-
10
8
import pytz
11
9
12
10
# stdlib datetime imports
@@ -31,7 +29,7 @@ from pandas._libs.tslibs.util cimport (
31
29
from pandas._libs.tslibs.timedeltas cimport cast_from_unit
32
30
from pandas._libs.tslibs.timezones cimport (
33
31
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 )
35
33
from pandas._libs.tslibs.timezones import UTC
36
34
from pandas._libs.tslibs.parsing import parse_datetime_string
37
35
@@ -385,9 +383,8 @@ cdef _TSObject convert_datetime_to_tsobject(datetime ts, object tz,
385
383
else :
386
384
obj.value = pydatetime_to_dt64(ts, & obj.dts)
387
385
# GH 24329 Take DST offset into account
388
- # use dateutil.tz.tzfile to check type
389
386
if ts.tzinfo is not None :
390
- if isinstance (ts.tzinfo, _dateutil_tzfile ):
387
+ if treat_tz_as_dateutil (ts.tzinfo):
391
388
if ts.tzinfo.is_ambiguous(ts):
392
389
dst_offset = ts.tzinfo.dst(ts)
393
390
obj.value += int (dst_offset.total_seconds() * 1e9 )
0 commit comments