MarcoGorelli opened a new issue, #44676:
URL: https://github.com/apache/arrow/issues/44676
### Describe the enhancement requested
In pandas / Polars, I can do:
```python
dict(df.group_by(['a', 'b', 'c']).__iter__())
```
There doesn't seem to be a built-in way to do this in PyArrow, hence I'm
opening this as a feature request
Concretely, if I have
```python
import pyarrow as pa
tbl = pa.table({'a': [1,1,3], 'b': [4, 4, 4], 'c': [1, 3, 2]})
```
then I'd like a way to end up with
```
{(3,
4): pyarrow.Table
a: int64
b: int64
c: int64
----
a: [[3]]
b: [[4]]
c: [[2]],
(1,
4): pyarrow.Table
a: int64
b: int64
c: int64
----
a: [[1,1]]
b: [[4,4]]
c: [[1,3]]}
```
---
For context, this would be for use in [Narwhals](), where we have tried to
come up with a
[workaround](https://github.com/narwhals-dev/narwhals/blob/9ecd1767d2cea6956d9ca8b2a12d584705f8023a/narwhals/_arrow/group_by.py#L82-L92),
but it does exhibit a noticeable slow-down as the number of grouping keys
grows - 3 keys is enough for it to be slower than pandas
### Component(s)
Python
--
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]