You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2020/12/16 08:38:00 UTC
[jira] [Commented] (ARROW-10936) [Python] support dateutil
timezones
[ https://issues.apache.org/jira/browse/ARROW-10936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17250170#comment-17250170 ]
Joris Van den Bossche commented on ARROW-10936:
-----------------------------------------------
[~ericdu] Thanks for the report. This is indeed something we should add.
We already have ARROW-5248 about this as well, so closing this issue as a duplicate
> [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
> Priority: Major
>
> Here are two main reasons:
> # As of Python 3.6, the [tzinfo documentation |https://docs.python.org/3/library/datetime.html#timezone-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)