We would like to add descending sorts in NumPy (numpy/numpy#31345), but one caveat is that the NaN sorting in NumPy should push NaNs to the end of the array in descending sorts.
However, the convention currently implemented here is the opposite: It considers NaNs like the largest possible value so that NaNs come first in a descending sort. This is a convention preferred e.g. by DataFrames (at least more common) I think, and has the advantage that the result differs from just flipping res[::-1] (for unstable sorts).
Adding another switch for it would probably not be hard, or if we expect no users of has_nan=True, descending=True one could change it (but it's an API break).
I would expect it is a relatively simple change otherwise.
CC @r-devulap maybe just for a quick thought (CC @MaanasArora for awareness).
We would like to add descending sorts in NumPy (numpy/numpy#31345), but one caveat is that the NaN sorting in NumPy should push NaNs to the end of the array in descending sorts.
However, the convention currently implemented here is the opposite: It considers NaNs like the largest possible value so that NaNs come first in a descending sort. This is a convention preferred e.g. by DataFrames (at least more common) I think, and has the advantage that the result differs from just flipping
res[::-1](for unstable sorts).Adding another switch for it would probably not be hard, or if we expect no users of
has_nan=True, descending=Trueone could change it (but it's an API break).I would expect it is a relatively simple change otherwise.
CC @r-devulap maybe just for a quick thought (CC @MaanasArora for awareness).