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

feat(python)!: Update reshape to return Array types instead of List types #16825

Merged
merged 12 commits into from
Jun 10, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 8, 2024

Closes #14005

reshape now returns an Array type instead of a List type.

Users can restore the old functionality by calling .arr.to_list() on the output. Note that this is not more expensive than it would be to create a List type directly, because reshaping into an array is basically free.

Example

Before:

>>> s = pl.Series([1, 2, 3, 4, 5, 6])
>>> s.reshape((2, 3))
shape: (2,)
Series: '' [list[i64]]
[
        [1, 2, 3]
        [4, 5, 6]
]

After:

>>> s.reshape((2, 3))
shape: (2,)
Series: '' [array[i64, 3]]
[
        [1, 2, 3]
        [4, 5, 6]
]

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jun 8, 2024
Copy link

codspeed-hq bot commented Jun 9, 2024

CodSpeed Performance Report

Merging #16825 will not alter performance

Comparing reshape-array (d4e7df0) with main (92af769)

Summary

✅ 37 untouched benchmarks

@stinodego stinodego marked this pull request as ready for review June 9, 2024 15:05
Copy link

codecov bot commented Jun 9, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 4 lines in your changes missing coverage. Please review.

Project coverage is 81.38%. Comparing base (0f1eb18) to head (d4e7df0).
Report is 2 commits behind head on main.

Files Patch % Lines
crates/polars-core/src/series/ops/reshape.rs 90.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16825      +/-   ##
==========================================
- Coverage   81.40%   81.38%   -0.03%     
==========================================
  Files        1425     1425              
  Lines      187627   187638      +11     
  Branches     2702     2702              
==========================================
- Hits       152738   152701      -37     
- Misses      34393    34441      +48     
  Partials      496      496              

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

crates/polars-core/src/series/ops/reshape.rs Outdated Show resolved Hide resolved
crates/polars-core/src/series/ops/reshape.rs Outdated Show resolved Hide resolved
crates/polars-core/src/series/ops/reshape.rs Outdated Show resolved Hide resolved
@stinodego stinodego force-pushed the reshape-array branch 2 times, most recently from 3e223ad to d4e7df0 Compare June 10, 2024 08:00
@ritchie46 ritchie46 merged commit ae87dbb into main Jun 10, 2024
36 of 52 checks passed
@ritchie46 ritchie46 deleted the reshape-array branch June 10, 2024 10:07
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reshape should return an Array column rather than a List column
2 participants