Python has a min() built-in function:
Copy>>> darr = [1, 3.14159, 1e100, -2.71828]
>>> min(darr)
-2.71828
Answer from Greg Hewgill on Stack Overflow Top answer 1 of 4
86
Python has a min() built-in function:
Copy>>> darr = [1, 3.14159, 1e100, -2.71828]
>>> min(darr)
-2.71828
2 of 4
25
If you want to use numpy, you must define darr to be a numpy array, not a list:
Copyimport numpy as np
darr = np.array([1, 3.14159, 1e100, -2.71828])
print(darr.min())
darr.argmin() will give you the index corresponding to the minimum.
The reason you were getting an error is because argmin is a method understood by numpy arrays, but not by Python lists.
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.min.html
numpy.min — NumPy v2.2 Manual
The maximum value of an array along a given axis, propagating any NaNs. ... The minimum value of an array along a given axis, ignoring any NaNs.
Videos
02:13
Max and Min of an array | Python Exercises for Beginners - Exercise ...
04:24
Calculate Max & Min of NumPy Array in Python (Example) | np.max ...
Find Minimum and Maximum Number in Array (Iterative and Recursive) ...
06:09
Find The Minimum Number In A List Without Using min() | Python ...
Max and Min of an array | Python Exercises for Beginners ...
00:53
How To Find Min/Max Value In Numpy Array | Python Tutorial - YouTube
W3Schools
w3schools.com › python › ref_func_min.asp
Python min() Function
Python Examples Python Compiler ... Python Certificate Python Training ... The min() function returns the item with the lowest value, or the item with the lowest value in an iterable....
Codecademy
codecademy.com › docs › python:numpy › built-in functions › .min()
Python:NumPy | Built-in Functions | .min() | Codecademy
June 9, 2025 - Finds the minimum value in an array or along a specified axis of an array.
NumPy
numpy.org › doc › stable › reference › generated › numpy.amin.html
numpy.amin — NumPy v2.4 Manual
January 31, 2021 - Return the minimum of an array or minimum along an axis.
Programiz
programiz.com › python-programming › numpy › methods › min
NumPy min()
Become a certified Python programmer. Try Programiz PRO! ... The min() method returns the smallest element of an array along an axis.
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.minimum.html
numpy.minimum — NumPy v2.1 Manual
Compare two arrays and return a new array containing the element-wise minima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least ...
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 02.04-computation-on-arrays-aggregates.html
Aggregations: Min, Max, and Everything In Between | Python Data Science Handbook
In particular, their optional arguments have different meanings, and np.sum is aware of multiple array dimensions, as we will see in the following section. Similarly, Python has built-in min and max functions, used to find the minimum value and maximum value of any given array:
NumPy
numpy.org › doc › stable › › reference › generated › numpy.min.html
numpy.min — NumPy v2.4 Manual
The maximum value of an array along a given axis, propagating any NaNs. ... The minimum value of an array along a given axis, ignoring any NaNs.
NumPy
numpy.org › doc › stable › reference › generated › numpy.minimum.html
numpy.minimum — NumPy v2.4 Manual
January 31, 2021 - Compare two arrays and return a new array containing the element-wise minima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least ...
Mimo
mimo.org › glossary › python › min
Python min(): Syntax, Usage, and Examples
Python · Open in Mimo · Open in Mimo · Copy Code · lists = [[3, 4, 1], [8, 2], [9, 0]] min_overall = min(min(lst) for lst in lists) print(min_overall) # Output: 0 · This works well for matrices or nested data structures. When working with numerical data, the numpy module provides its own version of min that's optimized for array operations: Python ·
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.minimum.html
numpy.minimum — NumPy v2.2 Manual
Compare two arrays and return a new array containing the element-wise minima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. The latter distinction is important for complex NaNs, which are defined as at least ...
DataCamp
datacamp.com › doc › numpy › min
NumPy min()
The NumPy `min()` function is a part of Array Computation & Analysis tools, which is used to find the smallest value in an array.