Skip to content

aggregateFor does not use default for statistics #2118

Description

@Jolanrensen

Discovered in #2102 (comment)

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIIf it touches our APIbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions