[
https://issues.apache.org/jira/browse/ARROW-10863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Antoine Pitrou resolved ARROW-10863.
------------------------------------
Resolution: Fixed
Issue resolved by pull request 8887
[https://github.com/apache/arrow/pull/8887]
> [Python] ExtensionArray.to_pandas not working
> ---------------------------------------------
>
> Key: ARROW-10863
> URL: https://issues.apache.org/jira/browse/ARROW-10863
> Project: Apache Arrow
> Issue Type: Bug
> Components: Python
> Affects Versions: 2.0.0
> Reporter: Marlene Mhangami
> Assignee: Joris Van den Bossche
> Priority: Major
> Labels: pandas, pull-request-available, python
> Fix For: 3.0.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Hi!
> When I create a pandas interval series and then convert it into a pyarrow
> array and then try to convert that pyarrow array back to pandas I'm getting
> an attribute error. The error says that Series object has no attribute
> `to_pandas`.
> I've added the code that produces the error below.
> {code:java}
> // code placeholder
> In [14]: x = pd.Series([pd.Interval(0, 1), pd.Interval(2, 3), pd.Interval(3,
> 4)])
> In [15]: y = pa.Array.from_pandas(x)
> In [16]: y.type
> Out[17]: ArrowIntervalType(extension<pandas.interval>)
> In [17]: y.to_pandas()
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call last)
> <ipython-input-17-48c5b189df56> in <module>
> ----> 1
> y.to_pandas()~/compose/etc/conda/cuda_10.2/envs/rapids/lib/python3.7/site-packages/pyarrow/array.pxi
> in
> pyarrow.lib._PandasConvertible.to_pandas()~/compose/etc/conda/cuda_10.2/envs/rapids/lib/python3.7/site-packages/pyarrow/array.pxi
> in
> pyarrow.lib.ExtensionArray._to_pandas()~/compose/etc/conda/cuda_10.2/envs/rapids/lib/python3.7/site-packages/pandas/core/generic.py
> in __getattr__(self, name)
> 5128 if
> self._info_axis._can_hold_identifiers_and_holds_name(name):
> 5129 return self[name]
> -> 5130 return object.__getattribute__(self, name)
> 5131
> 5132 def __setattr__(self, name: str, value) -> None:AttributeError:
> 'Series' object has no attribute 'to_pandas'
> {code}
> It would be great tp have a method to convert from a pyarrow interval array
> directly into a pandas series.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)