Repository navigation
Document that Series.unique does not preserve order - #12747
Merged
Merged
Conversation
The order of values returned by Series.unique is not guaranteed to match the order of first appearance in the data, because unique shuffles the data under the hood. Passing split_out=1 uses a tree reduction instead and preserves the original order. Closes dask#11758
Contributor
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 29 files ±0 29 suites ±0 6h 52m 40s ⏱️ + 16m 44s Results for commit 775d0e1. ± Comparison against base commit da08800. |
crusaderky
approved these changes
Nov 21, 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.
Closes #11758
Documents in the
Series.uniquedocstring that, unlikepandas.Series.unique, the order of the returned values is not guaranteed to match the order of first appearance, becauseuniqueshuffles the data under the hood. Passingsplit_out=1uses a tree reduction instead and preserves the original order (only suitable for low-cardinality data).Verified with a repro: default
unique()returns values in shuffled order vs pandas, whileunique(split_out=1)matches pandas order. Existingtest_unique(which already assertssplit_out=1order equality) passes, as do all 28 unique/drop_duplicates tests.Series.uniqueorder differs from Pandas #11758pixi run lint