numpy.sort() in Python Last Updated : 29 Nov, 2018 Comments Improve Suggest changes Like Article Like Report numpy.sort() : This function returns a sorted copy of an array. Parameters : arr : Array to be sorted. axis : Axis along which we need array to be started. order : This argument specifies which fields to compare first. kind : [‘quicksort’{default}, ‘mergesort’, ‘heapsort’]Sorting algorithm. Return : Sorted Array Python3 1== # importing libraries import numpy as np # sort along the first axis a = np.array([[12, 15], [10, 1]]) arr1 = np.sort(a, axis = 0) print ("Along first axis : \n", arr1) # sort along the last axis a = np.array([[10, 15], [12, 1]]) arr2 = np.sort(a, axis = -1) print ("\nAlong first axis : \n", arr2) a = np.array([[12, 15], [10, 1]]) arr1 = np.sort(a, axis = None) print ("\nAlong none axis : \n", arr1) Output : Along first axis : [[10 1] [12 15]] Along first axis : [[10 15] [ 1 12]] Along none axis : [ 1 10 12 15] Comment More infoAdvertise with us Next Article numpy.sort() in Python M mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-Sorting Searching Practice Tags : python Similar Reads Python | Numpy matrix.sort() With the help of matrix.sort() method, we are able to sort the values in a matrix by using the same method. Syntax : matrix.sort() Return : Return a sorted matrix Example #1 : In this example we are able to sort the elements in the matrix by using matrix.sort() method. Python3 1=1 # import the impor 1 min read numpy.sort_complex() in Python numpy.sort_complex() function is used to sort a complex array.It sorts the array by using the real part first, then the imaginary part. Syntax : numpy.sort_complex(arr) Parameters : arr : [array_like] Input array. Return : [complex ndarray] A sorted complex array. Code #1 : Python3 # Python program 1 min read numpy.searchsorted() in Python numpy.searchsorted() function is used to find the indices into a sorted array arr such that, if elements are inserted before the indices, the order of arr would be still preserved. Here, binary search is used to find the required insertion indices. Syntax : numpy.searchsorted(arr, num, side='left', 3 min read sort() in Python sort() method in Python sort the elements of a list in ascending or descending order. It modifies the original list in place, meaning it does not return a new list, but instead changes the list it is called on. Example:Pythona = [5, 3, 8, 1, 2] a.sort() print(a) a.sort(reverse=True) print(a)Output[1 4 min read Insertion Sort - Python Insertion sort is a simple sorting algorithm that works by iteratively inserting each element of an unsorted list into its correct position in a sorted portion of the list.Insertion SortThe insertionSort function takes an array arr as input. It first calculates the length of the array (n). If the le 3 min read Like