[NumPy-Tickets] [NumPy] #1745: Documentation of ndarray.clip is misleading

NumPy Trac numpy-tickets@scipy....
Fri Apr 29 13:48:42 CDT 2011


#1745: Documentation of ndarray.clip is misleading
-------------------------+--------------------------------------------------
 Reporter:  rainwoodman  |       Owner:  somebody   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  numpy.core   |     Version:  1.5.1      
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by bsouthey):

 Since this came from scipy ticket 1414. The numpy.clip function does have
 these keywords but not the method called by the array.

 {{{
 Python 2.5.5 (r255:77872, Nov  8 2010, 09:10:42)
 [GCC 4.5.1 20100924 (Red Hat 4.5.1-4)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
 '1.5.1'
 >>> a=np.arange(-10,10, dtype=float)
 >>> a.clip(a_min=0, a_max=10)
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 TypeError: 'a_max' is an invalid keyword argument for this function
 >>> a.clip(min=0, max=10)
  array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  2.,
 3.,  4.,  5.,  6.,  7.,  8., 9.])
 >>> np.clip(a,a_min=0, a_max=np.inf)
 array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  2.,
        3.,  4.,  5.,  6.,  7.,  8.,  9.])
 }}}

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


More information about the NumPy-Tickets mailing list