Skip to content

Conversation

@sachinn854
Copy link

Adds a Notes section to Index.union clarifying that, for Index
objects containing duplicate values, the operation behaves as a
multiset union where multiplicity is determined by the maximum
count across the two input Index objects.

This note also highlights that this differs from other set
operations such as difference and symmetric_difference,
which operate only on the carrier sets.

Closes #56137

@sachinn854 sachinn854 force-pushed the doc-index-union-multiset branch from 3ad82b3 to b6062ff Compare December 28, 2025 15:44
Comment on lines 1092 to 1094
all four parameters together. If ``freq`` is omitted, the resulting
``DatetimeIndex`` will have ``periods`` linearly spaced elements between
``start`` and ``end`` (closed on both sides).
Copy link
Member

Choose a reason for hiding this comment

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

The change here appears unrelated to the linked issue

Copy link
Author

Choose a reason for hiding this comment

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

Thanks — I have reverted the unrelated change in datetimes.py.
This PR now only updates the Index.union documentation.

Please let me know if any further changes are needed 🙂

@sachinn854 sachinn854 force-pushed the doc-index-union-multiset branch from b6062ff to f136a0c Compare December 31, 2025 06:20
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.

DOC: Note multiset-like behaviour of Index.union for indexes with duplicates

2 participants