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

Casting Array to another Array ignores width changes #15029

Closed
2 tasks done
stinodego opened this issue Mar 13, 2024 · 1 comment · Fixed by #14995
Closed
2 tasks done

Casting Array to another Array ignores width changes #15029

stinodego opened this issue Mar 13, 2024 · 1 comment · Fixed by #14995
Assignees
Labels
A-dtype-list/array Area: list/array data type accepted Ready for implementation bug Something isn't working P-low Priority: low python Related to Python Polars

Comments

@stinodego
Copy link
Member

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

import polars as pl

s = pl.Series([[1, 2], [3, 4]], dtype=pl.Array(pl.Int8, 2))
result = s.cast(pl.Array(pl.Int8, 4))
print(s)

Log output

shape: (2,)
Series: '' [array[i8, 2]]
[
        [1, 2]
        [3, 4]
]

Issue description

Casting an array to an array of a different width leads to a faulty state.

Expected behavior

This operation should either be prohibited or it should reshape the array and result in:

shape: (1,)
Series: '' [array[i8, 4]]
[
        [1, 2, 3, 4]
]

Installed versions

main

@stinodego stinodego added bug Something isn't working python Related to Python Polars needs triage Awaiting prioritization by a maintainer A-dtype-list/array Area: list/array data type P-low Priority: low and removed needs triage Awaiting prioritization by a maintainer labels Mar 13, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Mar 13, 2024
@stinodego
Copy link
Member Author

Discussed with Ritchie, and the intended behavior is raising an error (not reshaping).

@github-project-automation github-project-automation bot moved this from Ready to Done in Backlog Mar 15, 2024
@c-peters c-peters added the accepted Ready for implementation label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dtype-list/array Area: list/array data type accepted Ready for implementation bug Something isn't working P-low Priority: low python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants