Skip to content
New issue

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

Allow kwargs constraints in pl.when and expr.filter #12577

Closed
bkos opened this issue Nov 19, 2023 · 3 comments · Fixed by #12603 or #12689
Closed

Allow kwargs constraints in pl.when and expr.filter #12577

bkos opened this issue Nov 19, 2023 · 3 comments · Fixed by #12603 or #12689
Assignees
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars

Comments

@bkos
Copy link

bkos commented Nov 19, 2023

Description

As mentioned on discord with @stinodego, similar to what has recently been introduced for df.filter, it would be nice to have kwargs also for pl.when and expr.filter, e.g.:

# for pl.when
pl.when(a=1).then...

# for expr.filter
df.select(pl.col('a').filter(b=1))
@bkos bkos added the enhancement New feature or an improvement of an existing feature label Nov 19, 2023
@stinodego stinodego added accepted Ready for implementation python Related to Python Polars labels Nov 20, 2023
@alexander-beedie alexander-beedie self-assigned this Nov 21, 2023
@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Nov 21, 2023

Makes sense; I'll see if I can knock this out on the flight, since I implemented the recent filter update - just hit 11,500m altitude, have a few hours to kill, and seem to have got some free (but absolutely terrible) WiFi access ;)

@stinodego
Copy link
Member

Thanks @alexander-beedie ! Feel like picking up Expr/Series.filter as well?

@alexander-beedie
Copy link
Collaborator

alexander-beedie commented Nov 23, 2023

Thanks @alexander-beedie ! Feel like picking up Expr/Series.filter as well?

@stinodego Ah! Somehow looked right past the Expr request - I blame the altitude in the cabin, lol... Will upgrade Expr to match, though I don't think Series makes sense with **kwargs (as it can only filter itself), but it should also support *predicates 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
3 participants