Skip to content

Document that Series.unique does not preserve order - #12747

Merged
crusaderky merged 1 commit into
dask:mainfrom
FullStraing:docs/series-unique-order-note
Nov 21, 2026
Merged

crusaderky merged 1 commit into
dask:mainfrom
FullStraing:docs/series-unique-order-note

Conversation

@FullStraing

Copy link
Copy Markdown
Contributor

Closes #11758

Documents in the Series.unique docstring that, unlike pandas.Series.unique, the order of the returned values is not guaranteed to match the order of first appearance, because unique shuffles the data under the hood. Passing split_out=1 uses 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, while unique(split_out=1) matches pandas order. Existing test_unique (which already asserts split_out=1 order equality) passes, as do all 28 unique/drop_duplicates tests.

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
@github-actions

Copy link
Copy Markdown
Contributor

Unit Test Results

See 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
 19 934 tests ±0   18 505 ✅ ±0   1 429 💤 ±0  0 ❌ ±0 
436 381 runs  ±0  384 904 ✅  - 1  51 477 💤 +1  0 ❌ ±0 

Results for commit 775d0e1. ± Comparison against base commit da08800.

crusaderky

This comment was marked as outdated.

@crusaderky
crusaderky merged commit 81d59f8 into dask:main Nov 21, 2026
38 of 39 checks passed
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.

Document that Series.unique order differs from Pandas

2 participants