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

Unsupported aggregation functions return None on String columns #12935

Closed
orlp opened this issue Dec 7, 2023 · 5 comments · Fixed by #16521
Closed

Unsupported aggregation functions return None on String columns #12935

orlp opened this issue Dec 7, 2023 · 5 comments · Fixed by #16521
Assignees
Labels
A-api Area: changes to the public API accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Milestone

Comments

@orlp
Copy link
Collaborator

orlp commented Dec 7, 2023

Reproduction:

df = pl.DataFrame({"s": ["test", "foo"], "l": [[1], [2]]})
print(df)
print(df["s"].sum(), df["s"].min(), df["s"].max())
print(df["l"].sum(), df["l"].min(), df["l"].max())

This prints:

shape: (2, 2)
┌──────┬───────────┐
│ s    ┆ l         │
│ ---  ┆ ---       │
│ str  ┆ list[i64] │
╞══════╪═══════════╡
│ test ┆ [1]       │
│ foo  ┆ [2]       │
└──────┴───────────┘
None foo test
None None None

I'd expect sum/min/max to give proper errors for unsupported dtypes instead of silently returning None.

@orlp orlp changed the title sum/min/max silently returns None on unsupported dtyped sum/min/max silently returns None on unsupported dtypes Dec 7, 2023
@orlp orlp self-assigned this Dec 7, 2023
@orlp orlp added bug Something isn't working rust Related to Rust Polars labels Dec 7, 2023
@mcrumiller
Copy link
Contributor

Slightly related, should a utf8 sum be a concatenation of all elements?

pl.Series(["a"]) + pl.Series(["b"])
Series: '' [str]
[
        "ab"
]

@mcrumiller
Copy link
Contributor

@thomasfrederikhoeck yes, those are implemented.

@thomasfrederikhoeck
Copy link
Contributor

@mcrumiller I was a bit to fast on the trigger (I reailised and deleted :-D )

@orlp
Copy link
Collaborator Author

orlp commented Dec 8, 2023

@mcrumiller

Slightly related, should a utf8 sum be a concatenation of all elements?

I'd prefer not, the error message will redirect you to .str.concat which is the appropriate implementation.

@orlp orlp changed the title sum/min/max silently returns None on unsupported dtypes sum/min/max/std/var/mean silently returns None on unsupported dtypes Dec 8, 2023
@orlp orlp changed the title sum/min/max/std/var/mean silently returns None on unsupported dtypes sum/min/max/std/var/mean silently return None on unsupported dtypes Dec 8, 2023
@c-peters c-peters added the accepted Ready for implementation label Dec 11, 2023
@stinodego stinodego added the A-api Area: changes to the public API label Jan 12, 2024
@stinodego
Copy link
Member

stinodego commented Jan 12, 2024

This has been fixed for lists.

We should still update String methods and (possibly?) make String sum to redirect to str.concat.

@stinodego stinodego added this to the 1.0.0 milestone Jan 12, 2024
@stinodego stinodego added deprecation Add a deprecation warning to outdated functionality and removed bug Something isn't working labels Jan 12, 2024
@stinodego stinodego changed the title sum/min/max/std/var/mean silently return None on unsupported dtypes Aggregation functions return None on unsupported dtypes May 27, 2024
@stinodego stinodego removed their assignment May 27, 2024
@stinodego stinodego added python Related to Python Polars enhancement New feature or an improvement of an existing feature and removed deprecation Add a deprecation warning to outdated functionality labels May 27, 2024
@stinodego stinodego changed the title Aggregation functions return None on unsupported dtypes Aggregation functions return None on some unsupported dtypes May 27, 2024
@stinodego stinodego changed the title Aggregation functions return None on some unsupported dtypes Aggregation functions return None on String columns May 27, 2024
@stinodego stinodego changed the title Aggregation functions return None on String columns Unsupported aggregation functions return None on String columns May 27, 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 accepted Ready for implementation enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
7 participants