You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Joris Van den Bossche (Jira)" <ji...@apache.org> on 2019/10/03 15:28:00 UTC

[jira] [Commented] (ARROW-2428) [Python] Add API to map Arrow types (including extension types) to pandas ExtensionArray instances for to_pandas conversions

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

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

More thoughts on this?

I implemented a POC for case 1 described above in https://github.com/apache/arrow/pull/5512

This allows to roundtrip pandas ExtensionArrays, assuming the the pandas.ExtensionDtype implements a {{\_\_from_arrow\_\_}} to convert an Arrow array into a pandas ExtensionArray of that dtype (so it can be put in the resulting DataFrame as an extension array).

It doesn't yet handle to other cases described above, though.


> [Python] Add API to map Arrow types (including extension types) to pandas ExtensionArray instances for to_pandas conversions
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-2428
>                 URL: https://issues.apache.org/jira/browse/ARROW-2428
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Uwe Korn
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> With the next release of Pandas, it will be possible to define custom column types that back a {{pandas.Series}}. Thus we will not be able to cover all possible column types in the {{to_pandas}} conversion by default as we won't be aware of all extension arrays.
> To enable users to create {{ExtensionArray}} instances from Arrow columns in the {{to_pandas}} conversion, we should provide a hook in the {{to_pandas}} call where they can overload the default conversion routines with the ones that produce their {{ExtensionArray}} instances.
> This should avoid additional copies in the case where we would nowadays first convert the Arrow column into a default Pandas column (probably of object type) and the user would afterwards convert it to a more efficient {{ExtensionArray}}. This hook here will be especially useful when you build {{ExtensionArrays}} where the storage is backed by Arrow.
> The meta-issue that tracks the implementation inside of Pandas is: https://github.com/pandas-dev/pandas/issues/19696



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