Not sure if it can be done with numpy.sort, but you can use numpy.argsort for sure:

>>> arr
array([[ 105.,    4.],
       [  53.,  520.],
       [ 745.,  902.],
       [  19.,   nan],
       [ 184.,   nan],
       [  22.,   10.],
       [ 104.,   26.]])
>>> arr[np.argsort(arr[:,1])]
array([[ 105.,    4.],
       [  22.,   10.],
       [ 104.,   26.],
       [  53.,  520.],
       [ 745.,  902.],
       [  19.,   nan],
       [ 184.,   nan]])
Answer from alko on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 74131398 › ignore-nan-values-when-ranking-using-argsort
numpy - Ignore nan values when ranking using argsort - Stack Overflow
I have a below function that ranks 3rd column of 2D arrays inside of a three-dimensional array. arr[:, :, 3] = arr[:, :, 3].argsort(axis=1)[:, ::-1].argsort(axis=1) + 1 The problem is that nan val...
🌐
GitHub
github.com › pandas-dev › pandas › issues › 12694
BUG: Series.argsort() incorrect handling of NaNs · Issue #12694 · pandas-dev/pandas
March 22, 2016 - It appears that Series.argsort() is implemented as s.dropna().argsort().reindex(s.index, fill_value=-1) = np.argsort(s.dropna()).reindex(s.index, fill_value=-1). There are two problems with this: (a) Since the result represents integer indices into the original series s, the result should not have the same index as s.index -- it should either be a Series with index [0, 1, ...], or more likely simply be a NumPyarray; (b) The way NaNs are effectively removed before calling np.argsort() leads to indexes that are no longer appropriate into the original Series, resulting in the nonsensical results shown in [9] and [10] below.
Author   seth-p
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.Series.argsort.html
pandas.Series.argsort — pandas 3.0.1 documentation - PyData |
Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. ... Unused. Parameter needed for compatibility with DataFrame. kind{‘mergesort’, ‘quicksort’, ‘heapsort’, ‘stable’}, default ‘quicksort’ · Choice of sorting algorithm.
🌐
TutorialsPoint
tutorialspoint.com › how-to-leave-nan-as-nan-in-the-pandas-series-argsort-method
How to leave nan as nan in the pandas series argsort method?
March 9, 2022 - If the Series object contains any null values or missing values, then the argsort() method gives -1 to indicate the index of that missing value (Nan value). Unfortunately, the argsort method doesn't have any parameters to skip the Null values. If you want to change the default representation ...
Find elsewhere
🌐
Omz Software
omz-software.com › pythonista › numpy › reference › generated › numpy.sort.html
numpy.sort — NumPy v1.8 Manual
If both the real and imaginary parts are non-nan then the order is determined by the real parts except when they are equal, in which case the order is determined by the imaginary parts. Previous to numpy 1.4.0 sorting real and complex arrays containing nan values led to undefined behaviour.
🌐
Pandas
pandas.pydata.org › pandas-docs › stable › reference › api › pandas.Series.argsort.html
pandas.Series.argsort — pandas 2.3.3 documentation
Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. ... Unused. Parameter needed for compatibility with DataFrame. kind{‘mergesort’, ‘quicksort’, ‘heapsort’, ‘stable’}, default ‘quicksort’ · Choice of sorting algorithm.
🌐
CopyProgramming
copyprogramming.com › howto › using-numpy-argpartition-ignoring-nans
Python: Disregarding NaNs in numpy.argpartition
May 14, 2023 - Python - Using numpy.argpartition ignoring NaNs, np.argpartition (first_array, -N) [-N:] this works very good for an array without NaNs, but if there is NaNs the nan's are coming as the largest item … · Read other technology post: How can I clear data in a GridView?
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.sort.html
numpy.sort — NumPy v2.4 Manual
where R is a non-nan real value. Complex values with the same nan placements are sorted according to the non-nan part if it exists.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.argsort.html
numpy.argsort — NumPy v2.1 Manual
As of NumPy 1.4.0 argsort works with real/complex arrays containing nan values.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.argsort.html
numpy.argsort — NumPy v2.5.dev0 Manual
As of NumPy 1.4.0 argsort works with real/complex arrays containing nan values.
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.argsort.html
numpy.argsort — NumPy v2.3 Manual
As of NumPy 1.4.0 argsort works with real/complex arrays containing nan values.