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

list.arg_min() now returns 0 instead of null on an empty sub-list #10703

Closed
2 tasks done
sorhawell opened this issue Aug 23, 2023 · 1 comment
Closed
2 tasks done

list.arg_min() now returns 0 instead of null on an empty sub-list #10703

sorhawell opened this issue Aug 23, 2023 · 1 comment
Labels
bug Something isn't working rust Related to Rust Polars

Comments

@sorhawell
Copy link
Contributor

sorhawell commented Aug 23, 2023

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

in py-polars 0.18.5

pl.select( pl.lit(pl.Series([["a"],[]]))).with_columns(pl.all(),pl.all().list.arg_min().alias("arg_min"
),pl.all().list.arg_max().alias("arg_max"))
shape: (2, 3)
┌───────────┬─────────┬────────────┐
│           ┆ arg_minarg_max    │
│ ---------        │
│ list[str] ┆ u32u32        │
╞═══════════╪═════════╪════════════╡
│ ["a"]     ┆ 00          │
│ []        ┆ 04294967295 │
└───────────┴─────────┴────────────┘

Issue description

Noticed when bumping r-polars dependency to rust-polars 0.30.0 -> 0.32.0.

arg_min() now returns 0 instead of null on empty sub-list. However an empty list has zero length and there would be no first element to point to.

Expected behavior

as from rust-polars 0.30.0

pl.select( pl.lit(pl.Series([["a"],[]]))).with_columns(pl.all(),pl.all().list.arg_min().alias("arg_min"
),pl.all().list.arg_max().alias("arg_max"))
shape: (2, 3)
┌───────────┬─────────┬────────────┐
│           ┆ arg_minarg_max    │
│ ---------        │
│ list[str] ┆ u32u32        │
╞═══════════╪═════════╪════════════╡
│ ["a"]     ┆ 00          │
│ []        ┆ NullNull │
└───────────┴─────────┴────────────┘

in upcomming r-polars


### Installed versions

<details>

as of py-polars 0.18.5

</details>
@sorhawell sorhawell added bug Something isn't working rust Related to Rust Polars labels Aug 23, 2023
@reswqa
Copy link
Collaborator

reswqa commented Aug 25, 2023

This is fixed in #10716 and can be closed. :)

eitsupi added a commit to pola-rs/r-polars that referenced this issue Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rust Related to Rust Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants