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

Avoid shallow copies in groupby methods #17646

Open
wants to merge 2 commits into
base: branch-25.02
Choose a base branch
from

Conversation

mroeschke
Copy link
Contributor

Description

Noticed while working on #17644 that diff and fillna were make some unnecessary shallow copies of the grouping.value object. Also noticed that _cov_or_corr just pulled the column names out of grouping.value object, so made a separate API, values_column_names to just create the column names without pulling out the actual columns.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Dec 20, 2024
@mroeschke mroeschke self-assigned this Dec 20, 2024
@mroeschke mroeschke requested a review from a team as a code owner December 20, 2024 20:41
@mroeschke mroeschke requested review from bdice and Matt711 December 20, 2024 20:41
@@ -3542,6 +3539,13 @@ def keys(self):
self._key_columns[0], name=self.names[0]
)

@property
def values_column_names(self) -> list[Hashable]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def values_column_names(self) -> list[Hashable]:
def _values_column_names(self) -> list[Hashable]:

Does pandas have this public property? If not, should we just make it a private property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't, so I can make this private

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants