Kotlin / Kotlin/dataframe

Add KDocs for non-deprecated `median` APIs

Open
#1,973 0 comments 0 reactions 1 assignee Claimed by @Jolanrensen View on GitHub
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

## Add KDocs for non-deprecated `median` APIs

`core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt` contains many public `median` APIs without KDocs.

There is already a TODO in the file describing important behavior that should be reflected in KDocs:

- primitive numbers return `Double` / `Double?`
- comparable values return the original comparable type / nullable type
- non-primitive numbers follow comparable rules
- some lambda-based comparable overloads may require explicit type arguments due to Kotlin type inference limitations
- numeric median uses `QuantileEstimationMethod.R8`
- comparable median and `medianBy` use `QuantileEstimationMethod.R3`

Please add concise KDocs for the current non-deprecated APIs only. Deprecated overloads and binary-compatibility overloads do not need new KDocs.

### Scope

Add KDocs for non-deprecated overloads in these groups:

- `DataColumn.median`
- `DataColumn.medianOrNull`
- `DataColumn.medianBy`
- `DataColumn.medianByOrNull`
- `DataColumn.medianOf`
- `DataColumn.medianOfOrNull`
- `DataRow.rowMedianOf`
- `DataRow.rowMedianOfOrNull`
- `DataFrame.median`
- `DataFrame.medianOrNull`
- `DataFrame.medianFor`
- `DataFrame.medianOf`
- `DataFrame.medianOfOrNull`
- `DataFrame.medianBy`
- `DataFrame.medianByOrNull`
- `Grouped.median`
- `Grouped.medianFor`
- `Grouped.medianOf`
- `GroupBy.medianBy`
- `Pivot.median`
- `Pivot.medianFor`
- `Pivot.medianOf`
- `Pivot.medianBy`
- `PivotGroupBy.median`
- `PivotGroupBy.medianFor`
- `PivotGroupBy.medianOf`
- `PivotGroupBy.medianBy`

### KDocs should explain

- What each operation returns:
- median value
- row selected by median key
- row/dataframe with per-column medians
- grouped or pivoted median values
- Difference between:
- `median`
- `medianOrNull`
- `medianBy`
- `medianByOrNull`
- `medianOf`
- `medianOfOrNull`
- `medianFor`
- Return-type behavior:
- primitive numeric inputs return `Double`
- comparable inputs return the selected comparable type
- `*OrNull` variants return `null` for empty/all-null inputs
- non-null variants fail through `suggestIfNull`
- How `skipNaN` affects floating-point values.
- Which quantile estimation method is used:
- `R8` for primitive numeric medians
- `R3` for comparable medians and `medianBy`
- That some comparable lambda overloads may require explicit type arguments because of Kotlin type inference limitations.
- For grouped/pivot variants, that the operation is applied per group or per pivot cell.

### Acceptance criteria

- Non-deprecated public `median*` APIs have concise KDocs.
- Deprecated and hidden binary-compatibility overloads are not documented.
- KDocs are consistent with the existing site docs:
https://kotlin.github.io/dataframe/median.html
- KDocs include the behavior currently noted in the TODO comment.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.