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: Fix all-null list aggregations returning Null dtype #20992

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

lukemanley
Copy link
Contributor

@lukemanley lukemanley commented Jan 30, 2025

closes #17361

import polars as pl

df = pl.DataFrame(
    {
        "a": [None, None],
        "b": [None, None],
    },
    schema={
        "a": pl.List(pl.String),
        "b": pl.List(pl.Duration),
    }
)

df.select(
    pl.col("a").list.min(),
    pl.col("b").list.sum(),
)

BEFORE:

shape: (2, 2)
┌──────┬──────┐
│ a    ┆ b    │
│ ---  ┆ ---  │
│ null ┆ null │
╞══════╪══════╡
│ null ┆ null │
│ null ┆ null │
└──────┴──────┘

AFTER:

shape: (2, 2)
┌──────┬──────────────┐
│ a    ┆ b            │
│ ---  ┆ ---          │
│ str  ┆ duration[μs] │
╞══════╪══════════════╡
│ null ┆ null         │
│ null ┆ null         │
└──────┴──────────────┘

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jan 30, 2025
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.20%. Comparing base (ea1ea5a) to head (f138f61).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20992      +/-   ##
==========================================
- Coverage   79.20%   79.20%   -0.01%     
==========================================
  Files        1583     1583              
  Lines      225109   225112       +3     
  Branches     2581     2581              
==========================================
- Hits       178303   178301       -2     
- Misses      46216    46221       +5     
  Partials      590      590              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 233f9b3 into pola-rs:main Jan 31, 2025
27 checks passed
@lukemanley lukemanley deleted the list-all-null-agg branch January 31, 2025 10:43
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.

polars List type columns accessors not returning the right dtype
2 participants