temp[::-1].sort() sorts the array in place, whereas np.sort(temp)[::-1] creates a new array.

In [25]: temp = np.random.randint(1,10, 10)

In [26]: temp
Out[26]: array([5, 2, 7, 4, 4, 2, 8, 6, 4, 4])

In [27]: id(temp)
Out[27]: 139962713524944

In [28]: temp[::-1].sort()

In [29]: temp
Out[29]: array([8, 7, 6, 5, 4, 4, 4, 4, 2, 2])

In [30]: id(temp)
Out[30]: 139962713524944
Answer from Padraic Cunningham on Stack Overflow
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.sort.html
numpy.sort — NumPy v2.5 Manual
Sort order. If True, the returned array will be sorted in descending order. If False or None, the returned array will be sorted in ascending order. Values that are NaN are sorted to the end for both orders.
🌐
W3Schools
w3schools.com › python › numpy › numpy_array_sort.asp
NumPy Sorting Arrays
Sorting means putting elements in an ordered sequence. Ordered sequence is any sequence that has an order corresponding to elements, like numeric or alphabetical, ascending or descending. The NumPy ndarray object has a function called sort(), that will sort a specified array.
🌐
Programiz
programiz.com › python-programming › numpy › methods › sort
NumPy sort()
The sort() method sorts an array in ascending order. import numpy as np array = np.array([10, 2, 9, -1])
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.argsort.html
numpy.argsort — NumPy v2.5 Manual
Sort order. If True, the returned array will be sorted in descending order. If False or None, the returned array will be sorted in ascending order. Values that are NaN are sorted to the end for both orders.
🌐
Codecademy
codecademy.com › article › sorting-and-unary-operations-in-num-py
Sorting and Unary Operations in NumPy | Codecademy
The numpy.argsort() function returns the indices of the elements in an array that would sort the array in ascending order.
🌐
w3resource
w3resource.com › python-exercises › numpy › basic › numpy-basic-exercise-52.php
NumPy: Sort a given array by row and column in ascending order - w3resource
August 28, 2025 - By applying sorting operations separately to rows and columns, the program efficiently arranges the elements of the array in ascending order along both dimensions, facilitating data organization and analysis.
🌐
Medium
medium.com › @whyamit404 › sorting-numpy-arrays-by-column-using-numpy-sort-c45a44660dcc
Sorting NumPy Arrays by Column Using numpy.sort() | by whyamit404 | Medium
February 26, 2025 - By now, you should feel comfortable ... it’s ascending, descending, or using a specific column. The real beauty of argsort() lies in its flexibility, which is why it's one of the most powerful tools for sorting data. ... You might be wondering: “Can I sort more than one column at once?” The answer is yes! You can use np.lexsort() to perform multi-key sorting. Here's how: import numpy as np arr ...
Find elsewhere
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.sort.html
numpy.sort — NumPy v2.6.dev0 Manual
Sort order. If True, the returned array will be sorted in descending order. If False or None, the returned array will be sorted in ascending order. Values that are NaN are sorted to the end for both orders.
🌐
Codecademy
codecademy.com › docs › python:numpy › ndarray › .sort()
Python:NumPy | ndarray | .sort() | Codecademy
October 30, 2025 - The .sort() method sorts a NumPy array in-place in ascending order along a specified axis.
🌐
Happycodejourney
happycodejourney.com › languages › numpy › querying › sorting
NumPy Sorting – sort(), argsort(), axis, kind Explained
NumPy's np.sort() function sorts in ascending order by default and does not have a built-in descending parameter.
🌐
Sharp Sight
sharpsight.ai › blog › numpy-sort
A quick guide to NumPy sort - Sharp Sight
February 6, 2024 - You can use NumPy sort to sort those values in ascending order.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.argsort.html
numpy.argsort — NumPy v2.6.dev0 Manual
Sort order. If True, the returned array will be sorted in descending order. If False or None, the returned array will be sorted in ascending order. Values that are NaN are sorted to the end for both orders.
🌐
Python Tutorial
pythontutorial.net › home › python numpy › numpy sort()
NumPy sort() - Python Tutorial
August 10, 2022 - import numpy as np a = np.array([2, 3, 1]) b = np.sort(a)[::-1] print(b)Copy · Output: [3 2 1]Copy · In this example: First, the sort() function sorts the elements in the array a in ascending order (from low to high) Then, the slice [::-1] ...
🌐
Codecademy
codecademy.com › docs › python:numpy › built-in functions › .sort()
Python:NumPy | Built-in Functions | .sort() | Codecademy
July 25, 2025 - It depends which method you use: numpy.sort(array) returns a sorted copy without modifying the original, while array.sort() sorts the array in-place. The .sort() method only sorts in ascending order.
🌐
Programiz
programiz.com › python-programming › numpy › methods › argsort
NumPy argsort()
The argsort() method in NumPy sorts the array elements in ascending order and returns indices of the sorted elements. The argsort() method in NumPy sorts the array elements in ascending order and returns indices of the sorted elements.
🌐
Hyperskill
hyperskill.org › university › numpy › numpy-array-sort
NumPy Array Sort
September 4, 2024 - By default, np.sort() sorts the array in ascending order, returning a new sorted array without modifying the original array. You can also specify the axis parameter to sort the array along a particular axis. NumPy is a powerful tool for data manipulation and performing various mathematical ...
🌐
AskPython
askpython.com › home › 3 easy sorting techniques in numpy
3 Easy Sorting Techniques in NumPy - AskPython
March 31, 2021 - In order to sort the various elements present in the array structure, NumPy provides us with sort() function. With sort() function, we can sort the elements and segregate them in ascending to descending order, respectively.
🌐
Medium
giulio-laurenti.medium.com › sorting-numpy-arrays-de6fcf2b2282
Sorting Numpy Arrays. Sorting is the process of arranging… | by Giulio Laurenti, PhD | Medium
June 8, 2025 - numpy.sort() The numpy.sort() function creates a copy of the array and sorts it in ascending order, leaving the original array unchanged.