Skip to content

ENH: enable lazy copy in merge() for CoW #51297

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

Merged
merged 5 commits into from
Feb 11, 2023

Conversation

jorisvandenbossche
Copy link
Member

xref #49473

The current copy=False only works when merging on the index; when merging on keys, we currently get a [0, 1, 2, ..] join index for both left and right, and so that still results in a copy (but that can be avoided using the is_range_indexer utility)

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

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

lgtm.

As a follow up:

tests for left/right merges where only one side isn't copied

@phofl
Copy link
Member

phofl commented Feb 10, 2023

Ah mypy is complaining:

pandas/core/reshape/merge.py:155: error: Argument "copy" to "get_result" of "_MergeOperation" has incompatible type "Optional[bool]"; expected "bool"  [arg-type]

@phofl phofl merged commit 7986bc2 into pandas-dev:main Feb 11, 2023
@phofl
Copy link
Member

phofl commented Feb 11, 2023

thx @jorisvandenbossche

@phofl phofl added this to the 2.0 milestone Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants