Open avimallu opened 12 months ago
Using a struct works: pl.struct("^grp.*$")
Thanks! I wasn't aware that regular expressions could be used in struct
s as well.
Yeah, it almost seems like whatever is passed to over
should be implicitly wrapped in a struct?
e.g. I would have thought this would work:
df.with_columns(
pl.col("value").sum().over("^grp.*$")
)
# ComputeError: The name: 'value' passed to `LazyFrame.with_columns` is duplicate
Using pl.exclude
also seems to be affected:
# over with multiple explicit columns: ok
df.with_columns(
pl.col("value").min().over(["grp_1", "grp_2"]).alias("minimum")
)
# over with single column via exclude: ok
df.drop("grp_2").with_columns(
pl.col("value").min().over(pl.exclude("value")).alias("minimum")
)
# over with multiple columns via exclude: "the name: 'minimum' passed to `LazyFrame.with_columns` is duplicate"
df.with_columns(
pl.col("value").min().over((pl.exclude("value"))).alias("minimum")
)
This is expected: #19681
Checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
Issue description
I cannot use regular expressions within an
over
call to perform operations - it looks like this gets expanded into multiple columns, resulting in duplicate output column names.Expected behavior
Identical behaviour to:
Installed versions