raisadz commented on issue #48060:
URL: https://github.com/apache/arrow/issues/48060#issuecomment-3510653418

   > I'm slightly surprised we don't have this yet, not even as an aggregation. 
It would be nice to add it as a C++ kernel indeed.
   > 
   > [@raisadz](https://github.com/raisadz) for the min/max/mean/median/sum, 
you could use [aggregation 
kernels](https://arrow.apache.org/docs/cpp/compute.html#aggregations), though 
I'm sure this can be done more efficiently working directly on the ListArray:
   > 
   > import pyarrow as pa
   > import pyarrow.compute as pc
   > arr = pa.array([[1, 2, None, 0], [7, 7, None, 0], [1, 2, 3]])
   > offsets = pc.list_parent_indices(arr)
   > table = pa.Table.from_arrays([arr.values, offsets], names=["values", 
"offsets"])
   > table.group_by(["offsets"]).aggregate([("values", "min")])
   > 
   > pyarrow.Table
   > offsets: int64
   > values_min: int64
   > ----
   > offsets: [[0,1,2]]
   > values_min: [[0,0,1]]
   
   Thanks a lot for pointing me to the aggregation kernels @rok, it seems to 
work well for my task!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to