Preserve aligned Series weights and isolate reset-index weights - #321
Merged
Merged
Conversation
juaristi22
marked this pull request as ready for review
September 16, 2026 12:54
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MicroSeries binary operations now retain weights with their row labels when pandas aligns operands. For values
[10, 20], labels['b', 'a'], and weights[1, 9], adding values[2, 1]at labels['a', 'b']now produces the weighted total22 * 9 + 11 * 1 = 209; the operators previously returned 121 by reapplying weights positionally. Named arithmetic and comparison methods consistently use the calling MicroSeries' weights across pandas 2 and 3. Explicit reverse dispatch preserves weighted results when a plain pandas Series appears on the left.MicroDataFrame.reset_index now copies weight storage on pandas 2, so changing a result's weights cannot change its source's weighted statistics. Regression tests cover both mutation directions, drop and in-place variants, and partial MultiIndex resets. Existing safeguards continue to reject unknown or ambiguous row weights.
Validation:
058f8db: 593 full-suite tests and 30 interaction tests passed in each environment.make lintand the towncrier draft passed.Related #170. A warning for mismatched input weights remains a separate enhancement.