You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2019/11/05 17:30:00 UTC

[jira] [Resolved] (ARROW-7031) [Python] Expose the offsets of a ListArray in python

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

Wes McKinney resolved ARROW-7031.
---------------------------------
    Fix Version/s: 1.0.0
       Resolution: Fixed

Issue resolved by pull request 5759
[https://github.com/apache/arrow/pull/5759]

> [Python] Expose the offsets of a ListArray in python
> ----------------------------------------------------
>
>                 Key: ARROW-7031
>                 URL: https://issues.apache.org/jira/browse/ARROW-7031
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python
>            Reporter: Joris Van den Bossche
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.0.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Assume the following ListArray:
> {code}
> In [1]: arr = pa.ListArray.from_arrays(offsets=[0, 3, 5], values=[1, 2, 3, 4, 5])                                                                                                                                  
> In [2]: arr                                                                                                                                                                                                        
> Out[2]: 
> <pyarrow.lib.ListArray object at 0x7f11de71c708>
> [
>   [
>     1,
>     2,
>     3
>   ],
>   [
>     4,
>     5
>   ]
> ]
> {code}
> You can get the actual values as a flat array through {{.values}} / {{.flatten()}}, but there is currently no easy way to get back to the offsets (except from interpreting the buffers manually). 
> We should probably add an {{offsets}} attribute (there is actually also a TODO comment for that).



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