[Numpy-discussion] Getting the indexes of the myarray.min()

Perry Greenfield perry at stsci.edu
Thu May 13 14:41:00 CDT 2004

> > A do-all function that computes min, min location, max, max location, 
> > mean and std dev all at once would be nice (especially if the 
> > returned values were accessed by name, rather than just being a tuple 
> > of values, so they could be referenced safely and readably).
> > 
> > -- Russell
> > 
> We will definitely add something like this for 1.0 or 1.1.
> (but probably for min and max location, it will just be
> for the first encountered).
> Perry
To elaborate on this a bit, I'm thinking that the minmax
capability probably should be separated from statistics
(it's very common to want to do min max without wanting
to do mean or stdev, plus as others have noted, the statistics
can be a bit more involved).

There is one other aspect that needs user input.
How to handle ieee special values for things like minmax.
Right now the ufunc reductions have some odd behavior that
is a result of underlying C library behavior. A NaN isn't 
consistently handled in such comparisons (it appears to 
depend on the order when comparing a NaN to a regular float,
whichever appears second appears to be accepted in pairwise

I was thinking that one could add an exclude keyword
to the functions to indicate that ieee special values should
not be included (well, I suppose Inf should be for min max)
otherwise they would be. Any thoughts on this?


More information about the Numpy-discussion mailing list