Skip to content

[Python] Support conversion of pyarrow.RunEndEncodedArray to numpy/pandas #40659

@AlenkaF

Description

@AlenkaF

Describe the enhancement requested

We want to enable the conversion of Run-End Encoded arrays to numpy and pandas. For example, this should not fail:

In [1]: import pyarrow as pa
   ...: import pyarrow.compute as pc
   ...: 
   ...: arr = pc.run_end_encode([1, 1, 2, 3, 3, 3, 6])
   ...: arr.to_numpy()
---------------------------------------------------------------------------
ArrowNotImplementedError                  Traceback (most recent call last)
Cell In[1], line 5
      2 import pyarrow.compute as pc
      4 arr = pc.run_end_encode([1, 1, 2, 3, 3, 3, 6])
----> 5 arr.to_numpy()

File ~/repos/arrow/python/pyarrow/array.pxi:1585, in pyarrow.lib.Array.to_numpy()
   1583 
   1584         with nogil:
-> 1585             check_status(ConvertArrayToPandas(c_options, self.sp_array,
   1586                                               self, &out))
   1587 

File ~/repos/arrow/python/pyarrow/error.pxi:91, in pyarrow.lib.check_status()
     89     return -1
     90 
---> 91 raise convert_status(status)
     92 
     93 

ArrowNotImplementedError: No known equivalent Pandas block for Arrow data of type run_end_encoded<run_ends: int32, values: int64> is known.

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions