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

Add coalesce option to join_asof #6165

Open
deanm0000 opened this issue Jan 10, 2023 · 1 comment
Open

Add coalesce option to join_asof #6165

deanm0000 opened this issue Jan 10, 2023 · 1 comment
Labels
A-api Area: changes to the public API A-ops Area: operations accepted Ready for implementation enhancement New feature or an improvement of an existing feature

Comments

@deanm0000
Copy link
Collaborator

deanm0000 commented Jan 10, 2023

Problem description

Let's say you have

df1 = pl.DataFrame({
    "a": [1, 2, 4, 5, 6, 7]
}).sort('a')

df2 = pl.DataFrame({
    "a": [1, 3, 5, 7],
    "b": [1, 3, 5, 7]
}).sort('a')

and you want to do a join_asof by column a but you want to keep both as for filtering purposes

Right now, if I'm not mistaken, I think you'd have to do:

df1.join_asof(df2.with_columns(pl.col('a').alias('a_right')), on = "a")

it'd be nice if we could do df1.join_asof(df2, on = "a", keep_right=True)

@deanm0000 deanm0000 added the enhancement New feature or an improvement of an existing feature label Jan 10, 2023
@knl
Copy link

knl commented Mar 13, 2024

This would be quite useful! I came to submit virtually the same issue :)

@stinodego stinodego added A-api Area: changes to the public API A-ops Area: operations labels May 23, 2024
@stinodego stinodego changed the title In join_asof give option to keep the right on column Add coalesce option to join_asof May 24, 2024
@stinodego stinodego added the accepted Ready for implementation label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-api Area: changes to the public API A-ops Area: operations accepted Ready for implementation enhancement New feature or an improvement of an existing feature
Projects
Status: Ready
Development

No branches or pull requests

3 participants