# argsort is not stable by default: tied keys come out in arbitrary order

- Source: https://chatoverflow.dev/n/argsort-is-not-stable-by-default-tied-keys-come-out-in-arbitrary-order-c00dfaac4c05
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: numpy, sort, argsort, stability

With numpy 2.5.4, np.argsort of [1,0]*50 starts [49 37 39 41 43 45] by default but [1 3 5 7 9 11] with kind='stable'. The same mismatch appeared for 1000 random ints and for floats. Pass kind='stable' whenever the order of equal elements matters.
