Kotlin / Kotlin/dataframe

Add KDocs for non-deprecated `percentile` APIs

Open
#1,986 0 comments 0 reactions 1 assignee View on GitHub

@Jolanrensen is already working on this.

Since Jul 24, 2026.

KDocs
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Add KDocs for non-deprecated percentile APIs

The file core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/percentile.kt holds the public percentile APIs, and the coverage sheet marks the group percentile/* as missing KDocs. None of these functions are currently documented (there is only a TODO KDocs comment block at the top of the file). Please add concise KDocs for the current non-deprecated APIs only, excluding deprecated and binary-compatibility (@AccessApiOverload) overloads.

Scope

APIs needing KDocs, by receiver (each takes the percentile: Double argument):

  • DataColumn.*percentile, percentileOrNull, percentileBy, percentileByOrNull, percentileOf, percentileOfOrNull
  • DataRow.*rowPercentileOf, rowPercentileOfOrNull
  • DataFrame.*percentile, percentileOrNull, percentileFor, percentileOf, percentileOfOrNull, percentileBy, percentileByOrNull
  • Grouped.*percentile, percentileFor, percentileOf
  • GroupBy.*percentileBy
  • Pivot.*percentile, percentileFor, percentileOf, percentileBy
  • PivotGroupBy.*percentile, percentileFor, percentileOf, percentileBy
KDocs should explain
  • What each operation returns:
    • percentile — the percentile value (over the whole column / frame);
    • percentileFor — a DataRow/DataFrame with a separate percentile per selected column;
    • percentileOf — the percentile of a value computed per row/element via the given expression;
    • percentileBy — the whole row (or reduced group / pivot) at the given percentile of a comparable selector;
    • the *OrNull variants — the same, but return null instead of failing on empty / all-null input;
    • the grouped / pivoted variants — computed per group / per pivot cell.
  • The type behavior (already captured in the TODO KDocs block, lines 31–46):
    • for primitive numbers the result is Double (or null);
    • for other Comparable types the result is a value of that same type (or null);
    • careful: non-primitive numbers follow the comparable rules, not the numeric ones;
    • the non-OrNull variants fail via suggestIfNull on empty / all-null input; the *OrNull variants return null.
  • The percentile parameter (a Double, e.g. 50.0 for the median) and how skipNaN treats NaN in floating-point columns.
  • The quantile estimation method used: QuantileEstimationMethod.R8 for primitive numbers, R3 otherwise; percentileBy uses R3.
  • The KT-76683 caveat: for the lambda-return-type percentileOf / percentile { } overloads on non-number comparable types, explicit type arguments are required — e.g. df.percentile { intCol } works, but a String column needs df.percentile<_, String> { stringCol } (or passing the lambda positionally). This must be shown in the KDoc.
  • The optional name parameter for the Grouped variants and the separate parameter for the Pivot / PivotGroupBy variants.
Acceptance criteria
  • Concise KDocs are added to all non-deprecated percentile / percentileOrNull / percentileFor / percentileOf / percentileOfOrNull / percentileBy / percentileByOrNull / rowPercentileOf / rowPercentileOfOrNull overloads in percentile.kt.
  • No documentation is added for deprecated / @AccessApiOverload overloads (including the DeprecationLevel.ERROR rowPercentile() / rowPercentileOrNull() stubs).
  • KDocs cover the percentile and skipNaN parameters, the primitive-number → Double vs comparable → same-type return rules, and the empty/all-null behavior (suggestIfNull vs null).
  • KDocs document the KT-76683 explicit-type-argument requirement for the non-number comparable lambda overloads.
  • KDocs mention the quantile estimation method (R8 for numbers, R3 otherwise / for percentileBy).
  • KDocs clearly distinguish the value-returning, per-column aggregation (percentileFor), and row-selecting (percentileBy) variants.
  • Docs are consistent with the site docs at percentile.html.
  • The TODO KDocs comment block at the top of the file is removed once its content has been folded into the actual KDocs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.