## Question

Asked By – Stuart Berg

numpy.amax() will find the max value in an array, and numpy.amin() does the same for the min value. If I want to find both max and min, I have to call both functions, which requires passing over the (very big) array twice, which seems slow.

Is there a function in the numpy API that finds both max and min with only a single pass through the data?

**Now we will see solution for issue: NumPy: function for simultaneous max() and min() **

## Answer

Is there a function in the numpy API that finds both max and min with only a single pass through the data?

No. At the time of this writing, there is no such function. (And yes, if there *were* such a function, its performance would be *significantly* better than calling `numpy.amin()`

and `numpy.amax()`

successively on a large array.)

This question is answered By – Stuart Berg

**This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 **