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

fix(rust!, python): Error on value_counts on column named "counts" #10737

Merged
merged 3 commits into from
Aug 26, 2023

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Aug 26, 2023

Fixes #10732

Also did a bunch of code cleanup.

Changes

  • Add a check when constructing the value counts struct.
  • Dispatch Series.value_counts to the expression.
  • Rename multithreaded param to parallel - this is more in line with other functions like concat.
  • Clean up docstrings etc.

@github-actions github-actions bot added breaking rust Change that breaks backwards compatibility for the Rust crate fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Aug 26, 2023
@@ -8269,48 +8269,62 @@ def extend_constant(self, value: PythonLiteral | None, n: int) -> Self:

return self._from_pyexpr(self._pyexpr.extend_constant(value, n))

def value_counts(self, *, multithreaded: bool = False, sort: bool = False) -> Self:
@deprecate_renamed_parameter("multithreaded", "parallel", version="0.19.0")
def value_counts(self, *, sort: bool = False, parallel: bool = False) -> Self:
Copy link
Member Author

Choose a reason for hiding this comment

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

I switched the parameters here. I believe the "what" should come before the "how". i.e. parallel won't impact the result, only how it's computed. So these params should come last if possible.

@stinodego stinodego marked this pull request as ready for review August 26, 2023 10:52
@stinodego stinodego marked this pull request as draft August 26, 2023 15:16
@stinodego stinodego marked this pull request as ready for review August 26, 2023 16:08
@ritchie46 ritchie46 merged commit 9b41eda into main Aug 26, 2023
25 checks passed
@ritchie46 ritchie46 deleted the value-counts branch August 26, 2023 17:20
etiennebacher added a commit to pola-rs/r-polars that referenced this pull request Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking rust Change that breaks backwards compatibility for the Rust crate fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series.value_counts produces a data frame with duplicate column names
3 participants