[NumPy-Tickets] [NumPy] #1149: argmin doesn't work with datetime objects

NumPy Trac numpy-tickets@scipy....
Wed Feb 1 15:32:54 CST 2012


#1149: argmin doesn't work with datetime objects
-----------------------------------------+----------------------------------
 Reporter:  doylejg                      |       Owner:  somebody   
     Type:  defect                       |      Status:  new        
 Priority:  normal                       |   Milestone:  Unscheduled
Component:  numpy.core                   |     Version:  1.6.1      
 Keywords:  fromnumeric argmin datetime  |  
-----------------------------------------+----------------------------------

Comment(by bshanks):

 workaround (for the convenience of people who need to argmin dates):


 from numpy import isnan
 def argmin(listable):
     xs = list(listable)
     current_min = xs[0]
     current_min_loc = 0
     for i in range(len(xs)):
         item = xs[i]
         if item < current_min:
             current_min = item
             current_min_loc = i
         try:
             if isnan(item):
                 current_min = item
                 current_min_loc = i
         except TypeError:
             pass
     return current_min_loc

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1149#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list