You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "A. Coady (Jira)" <ji...@apache.org> on 2021/12/24 20:46:00 UTC

[jira] [Created] (ARROW-15202) Create pyarrow array using an object's `__array__` method.

A. Coady created ARROW-15202:
--------------------------------

             Summary: Create pyarrow array using an object's `__array__` method.
                 Key: ARROW-15202
                 URL: https://issues.apache.org/jira/browse/ARROW-15202
             Project: Apache Arrow
          Issue Type: New Feature
          Components: Python
    Affects Versions: 6.0.1
            Reporter: A. Coady


`pa.array` supports optimized creation from an object with the `__arrow_array__` method, or from a literal NumPy ndarray. But there's a performance gap if the input object has only an `__array__` method, as it isn't used.

 

So the user has to know to call `np.asarray` first. And even if the original object could be extended to support '__arrow_array__`, it doesn't seems like a great workaround if all that method would do is call `pa.array(np.asarray(self))`.

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)