Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Robert Kern
Keith Goodman wrote: x.min() and x.max() depend on the ordering of the elements: x = M.matrix([[ M.nan, 2.0, 1.0]]) x.min() nan x = M.matrix([[ 1.0, 2.0, M.nan]]) x.min() 1.0 If I were to try the latter in ipython, I'd assume, great, min() ignores NaNs. But then the former would be

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Keith Goodman
On 11/11/06, Robert Kern [EMAIL PROTECTED] wrote: Barring a clever solution (at least cleverer than I feel like being immediately), the way to solve this would be to check for nans in the array and deal with them separately (or simply ignore them in the case of x.min()). However, this

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Charles R Harris
On 11/11/06, Robert Kern [EMAIL PROTECTED] wrote: Keith Goodman wrote: x.min() and x.max() depend on the ordering of the elements: x = M.matrix([[ M.nan, 2.0, 1.0]]) x.min() nan x = M.matrix([[ 1.0, 2.0, M.nan]]) x.min() 1.0 If I were to try the latter in ipython, I'd assume, great, min() ignores

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Robert Kern
Keith Goodman wrote: How about a nanmin() function? Already there. In [2]: nanmin? Type: function Base Class: type 'function' Namespace: Interactive File:

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Tim Hochberg
Robert Kern wrote: Keith Goodman wrote: x.min() and x.max() depend on the ordering of the elements: x = M.matrix([[ M.nan, 2.0, 1.0]]) x.min() nan x = M.matrix([[ 1.0, 2.0, M.nan]]) x.min() 1.0 If I were to try the latter in ipython, I'd assume,

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Keith Goodman
On 11/11/06, Robert Kern [EMAIL PROTECTED] wrote: Keith Goodman wrote: How about a nanmin() function? Already there. In [2]: nanmin? Type: function Base Class: type 'function' Namespace: Interactive File:

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread A. M. Archibald
On 11/11/06, Charles R Harris [EMAIL PROTECTED] wrote: I think the problem is that the max and min functions use the first value in the array as the starting point. That could be fixed by using the first non-nan and returning nan if there aren't any real numbers. But it probably isn't worth

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Charles R Harris
On 11/11/06, Tim Hochberg [EMAIL PROTECTED] wrote: Robert Kern wrote:snip My preference would be to raise an error / warning when there is a nan in the array. Technically, there is no minimum value when a nan ispresent. I believe that this would be feasible be swapping the comparefrom 'a b' to

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Charles R Harris
On 11/11/06, Charles R Harris [EMAIL PROTECTED] wrote: On 11/11/06, Tim Hochberg [EMAIL PROTECTED] wrote: Robert Kern wrote:snip My preference would be to raise an error / warning when there is a nan in the array. Technically, there is no minimum value when a nan ispresent. I believe that this

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Tim Hochberg
Robert Kern wrote: Keith Goodman wrote: How about a nanmin() function? Already there. In [2]: nanmin? Type: function Base Class: type 'function' Namespace: Interactive File:

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Charles R Harris
On 11/11/06, Tim Hochberg [EMAIL PROTECTED] wrote: Robert Kern wrote: Keith Goodman wrote: How about a nanmin() function? Already there. In [2]: nanmin? Type: function Base Class: type 'function' Namespace:Interactive File:

Re: [Numpy-discussion] x.min() depends on ordering

2006-11-11 Thread Tim Hochberg
Charles R Harris wrote: On 11/11/06, *Tim Hochberg* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Robert Kern wrote: Keith Goodman wrote: How about a nanmin() function? Already there. In [2]: nanmin? Type: function