Skip to content

Add medianBy and percentileBy to the groupBy grammar#1878

Open
Allex-Nik wants to merge 3 commits into
masterfrom
median-by-percentile-by-in-group-by-grammar
Open

Add medianBy and percentileBy to the groupBy grammar#1878
Allex-Nik wants to merge 3 commits into
masterfrom
median-by-percentile-by-in-group-by-grammar

Conversation

@Allex-Nik
Copy link
Copy Markdown
Collaborator

Fixes #1785.

Adds medianBy and percentileBy to the Grammar of groupBy.

Additionally, introduces a couple of minor fixes:

  • corrects the explanation of medianBy and percentileBy in the groupBy and pivot KDocs and website docs;
  • fixes a parameter name in medianBy and percentileBy in the pivot grammar.

@Allex-Nik Allex-Nik requested a review from AndreiKingsley May 29, 2026 11:11
* `| `__`.`__[**`percentileBy`**][Pivot.percentileBy]**`(`**`percentile: `[`Double`][Double]**`) { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
*
* {@include [Indent]}
* __`.`__[**`with`**][Pivot.with]**` { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be on ReducedPivot instead? If we mean the function for the second step of reducing: transform ReducedPivot into a DataRow.

An overload on Pivot also exists though, so I'm not completely sure.

*
* {@include [Indent]}
* `| `__`.`__[**`medianBy`**][Pivot.medianBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
* `| `__`.`__[**`medianBy`**][Pivot.medianBy]**` { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the parameter be called like in the function declaration (rowExpression instead of column)?

of the [`row expression`](DataRow.md#row-expressions) supplied to the function.

* [`medianBy`](median.md) / [`percentileBy`](percentile.md) – to get the row with the value closest to the estimated
* [`medianBy`](median.md) / [`percentileBy`](percentile.md) – to get the row at the position closest to the estimated
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jolanrensen I think last time I incorrectly implemented what you meant. Does it sound better now? :)

* ### Reduce [GroupBy] into [DataFrame]
*
* {@include [Indent]}
* [GroupBy][GroupBy]`.`[**`minBy`**][GroupBy.minBy]**` { `**`column: `[`ColumnSelector`][ColumnSelector]**` }`**
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be RowExpression instead of ColumnSelector? Same for maxBy below. If yes, I'll fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing medianBy / percentileBy in groupBy Grammar

1 participant