Skip to content

Conversation

@deniskrds
Copy link

@deniskrds deniskrds commented Nov 22, 2025

…n) (#63169)

Previously, Index.intersection and Index.union (including MultiIndex implementations) would return a direct reference to self (or other) if the result was identical to the input. This allowed side effects where mutating the metadata (e.g. .name) of the result would corrupt the original index.

This change forces a shallow copy (deep=False) in these cases. This preserves the performance benefit of sharing the underlying data array while ensuring the Index container itself is a distinct object with independent metadata.

@deniskrds deniskrds force-pushed the fix-index-setops-mutation branch from 88fecc0 to 3e9186d Compare November 23, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Index.intersection returns reference instead of new instance

1 participant