[Tutor] maximum value in a Numeric array
john.ertl at fnmoc.navy.mil
Fri Dec 10 19:34:41 CET 2004
I am trying to get the maximum value in a 2-D array. I can use max but it
returns the 1-D array that the max value is in and I then I need to do max
again on that array to get the single max value.
There has to be a more straightforward way...I have just not found it.
>>> b = array([[1,2],[3,4]])
>>> c = max(b)
I could also flatten the array to 1 D first then do max but the array I am
going to be working with is fairly large.
More information about the Tutor