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

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

Joris Van den Bossche created ARROW-7031:
--------------------------------------------

             Summary: [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


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)