`aggregateFor` does not use `default` for statistics

Aperta
#2,118 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
kotlin
Ambito
data

Direzione di ricerca

Reproduce the issue with the provided Kotlin DataFrame example, then inspect DataFrame.xFor, aggregateFor, and the aggregators to determine where default values are applied. Decide whether defaults should handle NaN, be applied before statistics, or be removed; update the relevant KDocs and verify the chosen behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

API bug

Discovered in https://github.com/Kotlin/dataframe/pull/2102#discussion_r4131226749

val df = dataFrameOf(
    columnOf("Alice", "Bob", "Charlie", "Charlie") named "name",
    columnOf(null, null, null, null) named "group",
)

df.meanFor { group default 0 }.toDataFrame()

The result is NaN even though a default is set.
It turns out that this default is never used for DataFrame.xFor {} calls, as a statistic function can never return null, which is where the default would be used. Probably this default is only used for Pivot(GroupBy) calls.

We should either:

  • remove this default call
  • Make it work on NaN too (might require some changes in aggregators)
  • Make it apply the default before running the statistic

The KDocs will also need to be updated accordingly

Lingua principale
Kotlin
Stelle
1.1k
Fork
87
Merge medio
2g 21h
PR unite (30g)
40

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Kotlin/dataframe

Tutte le issue di Kotlin/dataframe

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.