Skip to content

Varying quantile by group is broken #20951

@orlp

Description

@orlp

Consider the following example:

df = pl.DataFrame(
    {
        "value": [1, 2, 1, 2],
        "quantile": [0, 0, 1, 1],
    }
)
df.group_by(pl.col.quantile).agg(pl.col.value.quantile(pl.col.quantile.first()))

Output:

shape: (2, 2)
┌──────────┬───────┐
│ quantile ┆ value │
│ ---      ┆ ---   │
│ i64      ┆ f64   │
╞══════════╪═══════╡
│ 0        ┆ 1.0   │
│ 1        ┆ 1.0   │
└──────────┴───────┘

I would expect the value of the quantile = 1 group to be 2.0, not 1.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-highPriority: highacceptedReady for implementationbugSomething isn't workingpythonRelated to Python Polars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions