Skip to content

feat: Parameter for pivot to always include value column name#26730

Merged
nameexhaustion merged 10 commits intopola-rs:mainfrom
itamarst:26700-pivot-names
Mar 10, 2026
Merged

feat: Parameter for pivot to always include value column name#26730
nameexhaustion merged 10 commits intopola-rs:mainfrom
itamarst:26700-pivot-names

Conversation

@itamarst
Copy link
Contributor

Fixes #26700

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars changes-dsl Do not merge if this label is present and red. labels Feb 26, 2026
@itamarst itamarst marked this pull request as ready for review February 26, 2026 19:45
@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.68%. Comparing base (6dada91) to head (b19f641).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-python/src/conversion/mod.rs 60.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26730      +/-   ##
==========================================
+ Coverage   81.63%   81.68%   +0.04%     
==========================================
  Files        1806     1805       -1     
  Lines      248032   248037       +5     
  Branches     3127     3132       +5     
==========================================
+ Hits       202484   202600     +116     
+ Misses      44742    44631     -111     
  Partials      806      806              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

orlp
orlp previously requested changes Mar 2, 2026
separator
Used as separator/delimiter in generated column names in case of multiple
`values` columns.
column_naming : {'auto', 'always_combine'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Says always_combine rather than combine.

separator
Used as separator/delimiter in generated column names in case of multiple
`values` columns.
column_naming : {'auto', 'always_combine'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

for i in 0..on_columns.height() {
let mut name = String::new();
if values.len() > 1 {
if values.len() > 1 || matches!(column_naming, PivotColumnNaming::Combine) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use a match here so this fails if we ever add new stuff?

let combine = match column_naming {
    PivotColumnNaming::Combine => true,
    PivotColumnNaming::Auto => values.len() > 1
}

@itamarst
Copy link
Contributor Author

itamarst commented Mar 2, 2026

Will do.

@itamarst itamarst requested a review from orlp March 3, 2026 20:38
nameexhaustion
nameexhaustion previously approved these changes Mar 9, 2026
@nameexhaustion nameexhaustion changed the title feat: Support always combining column names in pivots feat: Parameter for pivot to always include value column name Mar 9, 2026
@nameexhaustion nameexhaustion dismissed stale reviews from orlp and themself March 9, 2026 14:24

resolved

@nameexhaustion nameexhaustion removed the RC label Mar 9, 2026
@nameexhaustion nameexhaustion merged commit 9353358 into pola-rs:main Mar 10, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changes-dsl Do not merge if this label is present and red. enhancement New feature or an improvement of an existing feature python Related to Python Polars RC rust Related to Rust Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option for pivot to always include value column name

4 participants