You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Joris Van den Bossche (JIRA)" <ji...@apache.org> on 2019/06/12 10:17:00 UTC

[jira] [Commented] (ARROW-5248) [Python] support dateutil timezones

    [ https://issues.apache.org/jira/browse/ARROW-5248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16861969#comment-16861969 ] 

Joris Van den Bossche commented on ARROW-5248:
----------------------------------------------

Another example of dateutil timezone was reported in ARROW-5540.

Reproducible example:

{code:python}
In [32]: import dateutil

In [33]: tz = dateutil.tz.tzoffset(None, -14400)

In [34]: pd.Timestamp("2019-01-01", tz=tz)
Out[34]: Timestamp('2019-01-01 00:00:00-0400', tz='tzoffset(None, -14400)')

In [39]: pa.array(pd.Series([pd.Timestamp("2019-01-01", tz=tz)]))
...
ValueError: Unable to convert timezone `tzoffset(None, -14400)` to string
{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
>
> 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
(v7.6.3#76005)