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

Make horizontal and vertical versions of and(), any() consistent w.r.t default null strategy #12585

Closed
stfdxv opened this issue Nov 20, 2023 · 1 comment
Labels
bug Something isn't working enhancement New feature or an improvement of an existing feature P-medium Priority: medium

Comments

@stfdxv
Copy link

stfdxv commented Nov 20, 2023

Description

import polars as pl

df = pl.DataFrame({"a": [True, None], "b": [None, False]})

# Horizontal version uses Kleene logic by default
df_any_and_h = df.with_columns(
    any_h=pl.any_horizontal("a", "b"),
    all_h=pl.all_horizontal("a", "b"),
)
print(df_any_and_h)

# Vertical version ignores nulls by default
df_any_v = df.select(pl.any("a", "b"))
print(df_any_v)
df_all_v_default = df.select(pl.all("a", "b"))
print(df_all_v_default)

The default (and only) null strategy for horizontal version of and(), any() is to use Kleene logic. As if null represents boolean unknown.
The default null strategy for horizontal version of and(), any() is to ignore nulls. But can be changed to Kleene logic with ignore_nulls=False.
I expect them both to have the same default null strategy.

@stfdxv stfdxv added the enhancement New feature or an improvement of an existing feature label Nov 20, 2023
@deanm0000 deanm0000 added bug Something isn't working P-medium Priority: medium labels Aug 15, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Aug 15, 2024
@coastalwhite
Copy link
Collaborator

This is basically already added with bitwise aggregations #18994

@github-project-automation github-project-automation bot moved this from Ready to Done in Backlog Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or an improvement of an existing feature P-medium Priority: medium
Projects
Archived in project
Development

No branches or pull requests

3 participants