[
https://issues.apache.org/jira/browse/ARROW-5248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17252394#comment-17252394
]
Matt commented on ARROW-5248:
-----------------------------
I believe another instance of the same bug can be seen rather simply with the
following:
{code:java}
In [1]: import pyarrow as pa
In [2]: from dateutil.tz import tzlocal
In [3]: pa.timestamp('ns', tzlocal())
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-95e5f76d00ff> in <module>
----> 1 pa.timestamp('ns', tzlocal())
~/Development/jiracli/venv/lib/python3.8/site-packages/pyarrow/types.pxi in
pyarrow.lib.timestamp()
~/Development/jiracli/venv/lib/python3.8/site-packages/pyarrow/types.pxi in
pyarrow.lib.tzinfo_to_string()
~/Development/jiracli/venv/lib/python3.8/site-packages/pyarrow/error.pxi in
pyarrow.lib.pyarrow_internal_check_status()
~/Development/jiracli/venv/lib/python3.8/site-packages/dateutil/tz/tz.py in
tzname(self, dt)
236 @tzname_in_python2
237 def tzname(self, dt):
--> 238 return self._tznames[self._isdst(dt)]
239
240 def is_ambiguous(self, dt):
~/Development/jiracli/venv/lib/python3.8/site-packages/dateutil/tz/tz.py in
_isdst(self, dt, fold_naive)
289
290 # Check for ambiguous times:
--> 291 dstval = self._naive_is_dst(dt)
292 fold = getattr(dt, 'fold', None)
293
~/Development/jiracli/venv/lib/python3.8/site-packages/dateutil/tz/tz.py in
_naive_is_dst(self, dt)
257
258 def _naive_is_dst(self, dt):
--> 259 timestamp = _datetime_to_timestamp(dt)
260 return time.localtime(timestamp + time.timezone).tm_isdst
261
~/Development/jiracli/venv/lib/python3.8/site-packages/dateutil/tz/tz.py in
_datetime_to_timestamp(dt)
1812 seconds since January 1, 1970, ignoring the time zone.
1813 """
-> 1814 return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
1815
1816
AttributeError: 'NoneType' object has no attribute 'replace'{code}
> [Python] support dateutil timezones
> -----------------------------------
>
> Key: ARROW-5248
> URL: https://issues.apache.org/jira/browse/ARROW-5248
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Reporter: Joris Van den Bossche
> Priority: Minor
> Labels: beginner
> Fix For: 3.0.0
>
>
> The {{dateutil}} packages also provides a set of timezone objects
> (https://dateutil.readthedocs.io/en/stable/tz.html) in addition to {{pytz}}.
> In pyarrow, we only support pytz timezones (and the stdlib datetime.timezone
> fixed offset):
> {code}
> In [2]: import dateutil.tz
>
>
> In [3]: import pyarrow as pa
>
>
> In [5]: pa.timestamp('us', dateutil.tz.gettz('Europe/Brussels'))
>
>
> ...
> ~/miniconda3/envs/dev37/lib/python3.7/site-packages/pyarrow/types.pxi in
> pyarrow.lib.tzinfo_to_string()
> ValueError: Unable to convert timezone
> `tzfile('/usr/share/zoneinfo/Europe/Brussels')` to string
> {code}
> But pandas also supports dateutil timezones. As a consequence, when having a
> pandas DataFrame that uses a dateutil timezone, you get an error when
> converting to an arrow table.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)