Kotlin / Kotlin/dataframe

Define and add `countDistinct` aggregation for `Pivot` and `PivotGroupBy`

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

Description

Follow up of #533.

The `countDistinct` is currently not defined on `Pivot` and `PivotGroupBy`. We need to add these overloads for the API consistency (for example, the `count` function has them) and more straightforward counting distinct values on these receivers.

Functionality to add:

- On `Pivot`:
`df.pivot { column_0 }.countDistinct()`
`df.pivot { column_0 }.countDistinct { column_1 }`

- On `PivotGroupBy`:
`df.pivot { column_0 }.groupBy { column_1 }.countDistinct()`
`df.pivot { column_0 }.groupBy { column_1 }.countDistinct { column_2 }`

Tests and KDocs should be added, relevant existing documentation (for `countDistinct` and `pivot`) should be updated.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing count overloads for Pivot and PivotGroupBy and the current countDistinct and pivot documentation. Add the four requested overloads, tests, and KDocs, then update the relevant documentation; done means the listed examples compile and the tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.