Kotlin / Kotlin/dataframe

Make ReducedGroupBy implement DataFrame interface

Open
#778 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

This expression appears to be a shortcut
```
df_3.groupBy { year }.maxBy { gflops.toDouble() }
```
for
```
df_3.groupBy { year }.aggregate {
maxBy { gflops.toDouble() }
}
```
But it isn't. maxBy returns a `ReducedGroupBy` and you need to call `into` or `values` `df_3.groupBy { year }.maxBy { gflops.toDouble() }.values()`. I always found it to be confusing. Before you can work with data as it appears in the table, you need to figure out what `into` or `values` do. For me these functions seem like *optional steps*
![image](https://github.com/user-attachments/assets/c0c42f66-3a5c-4fbc-a701-309b3b5c106f)

We can use approach proposed [here](https://github.com/Kotlin/dataframe/commit/20cab7a12968babcb7f9d8ce8a24e3ca0917eda1) by @Jolanrensen and make ReducedGroupBy : DataFrame, so you can both use DF api and `into`, `values` on the object. See if it worth it for ReducedPivot and ReducedPivotGroupBy too. I wouldn't go as far as implementing it for all intermediate objects though because there all steps are mandatory. It doesn't make sense to `df.convert { }.add() { }`

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the ReducedGroupBy API and the linked commit approach. Check whether ReducedPivot and ReducedPivotGroupBy should be treated similarly, then verify that the resulting object supports DataFrame operations while into and values remain available; the groupBy/maxBy examples should work without an extra conversion step.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.