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

Columns with null dtype are ignored in sum_horizontal/mean_horizontal regardless of ignore_nulls parameter #20455

Closed
mcrumiller opened this issue Dec 25, 2024 · 1 comment · Fixed by #20469
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented Dec 25, 2024

Issue description

If one of the columns in sum_horizontal or mean_horizontal has a null dtype then it is ignored even if ignore_nulls = False.

import polars as pl

df = pl.DataFrame({
    "a": [None, None],
    "b": [1, 2],
})
df.select(pl.sum_horizontal("a", "b", ignore_nulls=False))
shape: (2, 1)
# ┌─────┐
# │ a   │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 1   │
# │ 2   │
# └─────┘

Installed versions

main

@mcrumiller mcrumiller added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Dec 25, 2024
@ritchie46
Copy link
Member

The above example is what I would expect. We don't propagate nulls in the sum, but use the identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants