apache / apache/arrow

[Python] Add pyarrow.TableGroupBy() subtables

Open
#34,491 2 comments 0 reactions 0 assignees View on GitHub
Component: Python Type: enhancement
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the enhancement requested

```python
import pyarrow as pa
t = pa.table([
pa.array(["a", "a", "b", "b", "c"]),
pa.array([1, 2, 3, 4, 5]),
], names=["keys", "values"])

for subtable in pa.TableGroupBy(t,"keys"): # loop over the 3 tables
subtable.to_pandas() # with the keys column

# alternatively
for key_name, subtable in pa.TableGroupBy(t,"keys"): # loop over the 3 tables
subtable.to_pandas() # without the keys column
```

### Component(s)

Python

Contributor guide

Open the contributing guide

Research direction

Start at the requested Python entry point, pa.TableGroupBy, and review how the existing pa.Table and grouping-related APIs are exposed. Define the iteration behavior for grouped subtables, including the alternatives with and without the keys column, and verify it with the example shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.