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

Reduce (shallow) copies in DataFrame ops #16060

Merged
merged 9 commits into from
Jun 26, 2024

Conversation

mroeschke
Copy link
Contributor

@mroeschke mroeschke commented Jun 18, 2024

Description

In particular for ops which only modify the axes

  • Reduce multiple shallow copies in DataFrame.rename
  • Avoid a shallow copy in DataFrame.to_arrow until necessary

Also fixes a bug in DataFrame.rename to maintain the original dtype of the columns after renaming

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 Jun 18, 2024
@mroeschke mroeschke requested a review from a team as a code owner June 18, 2024 22:01
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

One question, should I read this statement:

shallow copies instead of deep copies like pandas

To mean "perform shallow copies like pandas, instead of the previous deep copies"?

Or "perform shallow copies, unlike pandas which does deep copies"?

I presume the former?

@mroeschke
Copy link
Contributor Author

"perform shallow copies like pandas, instead of the previous deep copies"

Yes, this is what I intended to communicate. Sorry for the lack of clarity

@mroeschke mroeschke changed the title Reduce (deep) copies in DataFrame ops Reduce (shallow) copies in DataFrame ops Jun 26, 2024
@mroeschke
Copy link
Contributor Author

I actually noticed my copy comparisons to pandas was based on the pandas main branch which has copy-on-write enabled and therefore shallow copies could be made instead of deep copies. I reverted changes to the APIs where I changed the deep copy behavior and added a comment instead for a future change with copy on write.

@wence-
Copy link
Contributor

wence- commented Jun 26, 2024

I reran things, based on hopefully rapidsai/shared-workflows#221 being fixed

@vyasr
Copy link
Contributor

vyasr commented Jun 26, 2024

Changes to shared workflows will require pushing an empty commit to restart CI, IIRC just rerunning jobs will reuse the cached workflows from before.

@mroeschke
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 563556e into rapidsai:branch-24.08 Jun 26, 2024
75 checks passed
@mroeschke mroeschke deleted the perf/copies/dataframe branch June 26, 2024 23:25
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
None yet
Development

Successfully merging this pull request may close these issues.

4 participants