All,

Thanks for the help...I am using the older Numeric 23.4.  I have some stuff
that cannot use Numarray yet.  Numeric does not seam to have the same
functionality.

Happy Holidays.

John Ertl

-----Original Message-----
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Friday, December 10, 2004 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 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]])
> >>> max(b)
> array([3, 4])
> >>> c = max(b)
> >>> max(c)
> 4

Hi John,

According to:

    http://stsdas.stsci.edu/numarray/numarray-1.1.html/node35.html#l2h-108

you can use the 'max()' method of an array:

###
>>> import numarray
>>> b = numarray.array([[1,2],[3,4]])
>>> b.max()
4
###


Hope this helps!
_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to