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

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

For dateutil, I indeed don't directly know how to get the zone name. You can 
get the "displayed name" with:

{code:python}
>>> import dateutil
>>> tz = dateutil.tz.gettz('Europe/Brussels')
>>> tz
tzfile('/usr/share/zoneinfo/Europe/Brussels')
>>> import datetime
>>> dt = datetime.datetime(2012, 1, 1)
>>> tz.tzname(dt)
'CET'
{code}

but that's not the name we want to store in the tz metadata.

There seems to be a long-time issue about it: 
https://github.com/dateutil/dateutil/issues/76

> [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
>
> 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)

Reply via email to