[Numpy-tickets] [NumPy] #391: argsort default axis + axis=None

NumPy numpy-tickets at scipy.net
Tue Nov 28 14:13:19 CST 2006


#391: argsort default axis + axis=None
------------------------+---------------------------------------------------
 Reporter:  pierregm    |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.core  |     Version:          
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 Folks,
 The default axis for `argsort` (method & function) is -1, when it's `None`
 for `argmin` and `argmax`.
 Moreover, forcing the axis to `None` raises a `TypeError: an integer is
 required` exception.


 {{{
 >>>import numpy as N
 >>>N.version.version
 '1.0.1.dev3460'
 >>>a=N.array([[1,3],[2,4]])
 >>>N.argmin(a), N.argmax(a),
 (0,3)
 >>>N.argsort(a)
 array([[0, 1],
        [0, 1]])
 >>>N.argsort(a,None)
 /usr/lib64/python2.4/site-packages/numpy/core/fromnumeric.py in argsort(a,
 axis, kind)
     192     except AttributeError:
     193         return _wrapit(a, 'argsort', axis, kind)
 --> 194     return argsort(axis, kind)
     195
     196 def argmax(a, axis=None):

 TypeError: an integer is required
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/391>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list