We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
value
quantile = 1
2.0
1.0
The text was updated successfully, but these errors were encountered:
I also ran into this issue. Was about to open an issue.
I found that using map_groups returns the correct results, but it's slower:
map_groups
( df .group_by("quantile") .map_groups(lambda group_df: group_df.select( pl.col.quantile.first(), pl.col.value.quantile(pl.col.quantile.first()) )) )
shape: (2, 2) ┌──────────┬───────┐ │ quantile ┆ value │ │ --- ┆ --- │ │ i64 ┆ f64 │ ╞══════════╪═══════╡ │ 0 ┆ 1.0 │ │ 1 ┆ 2.0 │ └──────────┴───────┘
Sorry, something went wrong.
No branches or pull requests
Consider the following example:
Output:
I would expect the
value
of thequantile = 1
group to be2.0
, not1.0
.The text was updated successfully, but these errors were encountered: