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: Update DataFrame.pivot to allow index=None when values is set #17126

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Jun 22, 2024

closes #11592, though using a different solution than suggested - here I'm implementing "if index is not specified, use all remaining columns", just as is already done for values, as well as for unpivot. Related discussion #17095

I've also rewritten the pivot docstring examples, as I think they started off too complicated. It now starts with the simplest case, and then builds up

@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 labels Jun 22, 2024
@MarcoGorelli MarcoGorelli force-pushed the optional-values branch 3 times, most recently from 65b15c2 to 23481be Compare June 22, 2024 13:43
Copy link

codecov bot commented Jun 22, 2024

Codecov Report

Attention: Patch coverage is 97.56098% with 1 line in your changes missing coverage. Please review.

Project coverage is 80.87%. Comparing base (7f5412a) to head (23481be).
Report is 4 commits behind head on main.

Current head 23481be differs from pull request most recent head eb89ca6

Please upload reports for the commit eb89ca6 to get more accurate results.

Files Patch % Lines
crates/polars-lazy/src/frame/pivot.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17126   +/-   ##
=======================================
  Coverage   80.86%   80.87%           
=======================================
  Files        1456     1456           
  Lines      191337   191351   +14     
  Branches     2739     2740    +1     
=======================================
+ Hits       154721   154748   +27     
+ Misses      36109    36096   -13     
  Partials      507      507           

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

Copy link
Member

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! Indeed, makes sense that either index or values can be None.

Good to merge when CI is green.

@stinodego stinodego changed the title feat: let index and values both be optional in pivot feat: Update DataFrame.pivot to allow index=None when values is set Jun 22, 2024
@stinodego stinodego merged commit 3117ab1 into pola-rs:main Jun 22, 2024
31 checks passed
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
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame.pivot does not work with index=None even though function signature implies it is acceptable
2 participants