[NumPy-Tickets] [NumPy] #2078: min/max/mean of empty arrays

NumPy Trac numpy-tickets@scipy....
Sun Mar 11 00:04:40 CST 2012


#2078: min/max/mean of empty arrays
------------------------+---------------------------------------------------
 Reporter:  muellner    |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  devel      
 Keywords:              |  
------------------------+---------------------------------------------------
 []In NumPy release 1.5.1, the minimum/maximum/mean of empty arrays is
 handled in a sensible way, namely by returning an empty array:

 {{{
 >>> numpy.min(numpy.zeros((0,2)), axis=1)
 array([], dtype=float64)
 }}}

 Likewise for max and mean.

 This behavior is broken in NumPy 1.7.0.dev-56f66bb, and the line above
 raises a ValueError. Is this a bug or a feature? Personally, I prefer the
 old behavior, as it allows the easy handling of special cases (zero-sized
 arrays) without the need for extra checks.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2078>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list