How to find the maximum and minimum value in NumPy 1d-array? Last Updated : 02 May, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report Let's see the various ways to find the maximum and minimum value in NumPy 1d-array. Method 1: Using numpy.amax() and numpy.amin() functions of NumPy library. numpy.amax(): This function returns maximum of an array or maximum along axis(if mentioned). numpy.amin(): This function returns minimum of an array or minimum along axis(if mentioned). Example: Python3 # import library import numpy as np # create a numpy 1d-array array = np.array([1, 2, 3, 0, -1, -2]) # find max element in an array max_ele = np.amax(array) # find min element in an array min_ele = np.amin(array) # show the outputs print("Given Array:", array) print("Max Element:", max_ele) print("Min Element:", min_ele) Output: Given Array: [ 1 2 3 0 -1 -2] Max Element: 3 Min Element: -2 Method 2: Using numpy.argmax() and numpy.argmin() function of NumPy library. numpy.argmax(): This function returns indices of the max element of the array in a particular axis(if mentioned).numpy.argmin(): This function returns indices of the min element of the array in a particular axis(if mentioned). Example: Python3 # import library import numpy as np # create a numpy 1d-array array = np.array([1, 2, 3, 0, -1, -2]) # find index of max element # in an array max_ele_index = np.argmax(array) # find max element in an array max_ele = array[max_ele_index] # find index of min element # in an array min_ele_index = np.argmin(array) # find min element in an array min_ele = array[min_ele_index] # show the outputs print("Given Array:", array) print("Max Element:", max_ele) print("Min Element:", min_ele) Output: Given Array: [ 1 2 3 0 -1 -2] Max Element: 3 Min Element: -2 Comment More infoAdvertise with us Next Article How to find the maximum and minimum value in NumPy 1d-array? A ankthon Follow Improve Article Tags : Python Python-numpy Python numpy-program Python numpy-arrayManipulation Practice Tags : python Similar Reads Find the maximum and minimum element in a NumPy array An array can be considered as a container with the same types of elements. Python has its array module named array. We can simply import the module and create our array. But this module has some of its drawbacks. The main disadvantage is we can't create a multidimensional array. And the data type mu 4 min read How to find the Index of value in Numpy Array ? In this article, we are going to find the index of the elements present in a Numpy array.Using where() Methodwhere() method is used to specify the index of a particular element specified in the condition.Syntax: numpy.where(condition[, x, y])Example 1: Get index positions of a given valueHere, we fi 5 min read Find the nearest value and the index of NumPy Array In this article, let's discuss finding the nearest value and the index in an array with Numpy. We will make use of two of the functions provided by the NumPy library to calculate the nearest value and the index in the array. Those two functions are numpy.abs() and numpy.argmin(). Example Input Arra 3 min read Maximum and Minimum element in a Set in Python We are given a set and our task is to find the maximum and minimum elements from the given set. For example, if we have a = {3, 1, 7, 5, 9}, the maximum element should be 9, and the minimum element should be 1.Letâs explore different methods to do it:1. Using min() & max() functionThe built-in m 3 min read Find the most frequent value in a NumPy array In this article, let's discuss how to find the most frequent value in the NumPy array. Steps to find the most frequency value in a NumPy array: Create a NumPy array.Apply bincount() method of NumPy to get the count of occurrences of each element in the array.The n, apply argmax() method to get the 1 min read Like