[Python] Add pyarrow.TableGroupBy.groups method
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 88
Description
### Describe the enhancement requested
This method would return a table with one column for each key and one row for each unique combination of keys. This can actually be done today by passing in an empty list of aggregates, and the result should be identical, however this is not obvious behavior to the user:
```
>>> tab = pa.Table.from_pydict({"x": [1, 2, 3, 1, 2, 3], "y": ["a", "b", "c", "c", "b", "a"]})
>>> tab.group_by(["x", "y"]).aggregate([])
pyarrow.Table
x: int64
y: string
----
x: [[1,2,3,1,3]]
y: [["a","b","c","c","a"]]
```
### Component(s)
Python
Contributor guide
Research direction
Start with the Python TableGroupBy API and the existing aggregate([]) behavior shown in the issue. Add groups so it returns one column per grouping key and one row per unique key combination, with results matching aggregate([]); verify the example behavior with the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100