Skip to content

REGR: Fix regression when grouping over a Series #57323

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 3 commits into from
Feb 10, 2024
Merged

Conversation

phofl
Copy link
Member

@phofl phofl commented Feb 9, 2024

@phofl phofl added this to the 2.2.1 milestone Feb 9, 2024
@phofl phofl added Regression Functionality that used to work in a prior pandas version Copy / view semantics labels Feb 9, 2024
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

Looks good!

ref = weakref.ref(self.blocks[blkno])
return ref in mgr.blocks[blkno].refs.referenced_blocks
blk = self.blocks[blkno]
return any(blk is ref() for ref in mgr.blocks[blkno].refs.referenced_blocks)
Copy link
Member

Choose a reason for hiding this comment

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

At the point where df["col"].index is df.index is no longer true, we will have to update this, but I assume we can handle that at that point

Copy link
Member Author

Choose a reason for hiding this comment

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

That should work anyway though, since df.col.index will also be in the references since it still shares values with df.index. All shallow copies of the original values should be in there, that’s the elegant think about the tracking mechanism

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually index checks will never get there since it's defined on the manager

@phofl phofl merged commit 82abcd9 into pandas-dev:main Feb 10, 2024
@phofl phofl deleted the 57276 branch February 10, 2024 21:10
meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Feb 10, 2024
phofl added a commit that referenced this pull request Feb 10, 2024
…g over a Series) (#57339)

Backport PR #57323: REGR: Fix regression when grouping over a Series

Co-authored-by: Patrick Hoefler <[email protected]>
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Copy / view semantics Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: BlockManager.references_same_values not working with object-dtype block that has reference to an Index
2 participants