> 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.
> I could also flat
11:26
To: Ertl, John
Cc: [EMAIL PROTECTED]
Subject: Re: [Tutor] maximum value in a Numeric array
On Fri, 10 Dec 2004, Ertl, John wrote:
> 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
On Fri, 10 Dec 2004, Ertl, John wrote:
> 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 h
Are you using numarray? If so, there appears to be a max method of an array, so
you can try
b = array([[1,2],[3,4]])
b.max()
Note that your method of finding the max row, then finding the max in the row, will not in general
give the correct result. Sequences are compared lexicographically - the f