You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Eric Du (Jira)" <ji...@apache.org> on 2020/12/16 05:14:01 UTC

[jira] [Created] (ARROW-10936) [Python] support dateutil timezones

Eric Du created ARROW-10936:
-------------------------------

             Summary: [Python] support dateutil timezones 
                 Key: ARROW-10936
                 URL: https://issues.apache.org/jira/browse/ARROW-10936
             Project: Apache Arrow
          Issue Type: New Feature
          Components: Python
    Affects Versions: 2.0.0
            Reporter: Eric Du


Here are two main reasons:
 # As of Python 3.6, the [tzinfo documentation |#tzinfo-objects]] recommends {{dateutil.tz}} rather than {{pytz}} as an IANA time zone provider.
 # Pandas supports dateutil timezones.

When having a pandas DataFrame that uses a dateutil timezone,  you get an error. 

Below is a code sample:
{code:python}
import dateutil
tz = dateutil.tz.gettz('Asia/Shanghai')
df = pd.DataFrame({'a': list(range(1, 4)), 'b': pd.date_range('20130101', periods=3, tz=tz)})
df.to_feather('df.feather')
{code}
Errors:
{code:java}
ArrowInvalid: ('Object returned by tzinfo.utcoffset(None) is not an instance of datetime.timedelta', "Conversion failed for column b with type datetime64[ns, tzfile('/usr/share/zoneinfo/Asia/Shanghai')]"){code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)