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

fix(rust, python): fix Boolean::isin(null values) #10074

Merged
merged 2 commits into from
Jul 26, 2023
Merged

fix(rust, python): fix Boolean::isin(null values) #10074

merged 2 commits into from
Jul 26, 2023

Conversation

ritchie46
Copy link
Member

continued on #10073

fixes #10057

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jul 25, 2023
@gab23r
Copy link
Contributor

gab23r commented Jul 25, 2023

I don't understand the test here. I think that the test should be:

def test_is_in_bool() -> None:
    vals = [True, None]
    df = pl.DataFrame({"A": [True, False, None]})
    assert df.select(pl.col("A").is_in(vals)).to_dict(False) == {
        "A": [True, None] # No FALSE here
    }

Or I am missing wormething ?

@ritchie46
Copy link
Member Author

There should be a False as False is not in vals.

@gab23r
Copy link
Contributor

gab23r commented Jul 25, 2023

I don't understand, if I do .is_in([True, None]), it should be the same as .eq(True) | .is_null(), but I don't want False here

@ritchie46
Copy link
Member Author

ritchie46 commented Jul 25, 2023

The second value is False, which is not True and is not null, so the the result is False?

Note that I am not filtering.

@gab23r
Copy link
Contributor

gab23r commented Jul 25, 2023

Oh I did not see that you changed the filter by select !

@mcrumiller
Copy link
Contributor

Also fixes #9247.

@ritchie46 ritchie46 merged commit e181a3e into main Jul 26, 2023
@ritchie46 ritchie46 deleted the bool_isin branch July 26, 2023 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

is_in for boolean gives wrong result with Null
3 participants