[ 
https://issues.apache.org/jira/browse/ARROW-10936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Du updated ARROW-10936:
----------------------------
    Description: 
Here are two main reasons:
 # As of Python 3.6, the [[tzinfo documentation 
|https://docs.python.org/3/library/datetime.html#timezone-objects]|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}
 

  was:
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}
 


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

Reply via email to