[NumPy-Tickets] [NumPy] #1892: numpy.vectorize truncates strings

NumPy Trac numpy-tickets@scipy....
Mon Jul 4 05:14:52 CDT 2011


#1892: numpy.vectorize truncates strings
---------------------------------------+------------------------------------
 Reporter:  ehiggs                     |       Owner:  somebody   
     Type:  defect                     |      Status:  new        
 Priority:  normal                     |   Milestone:  Unscheduled
Component:  Other                      |     Version:  1.3.0      
 Keywords:  vectorize string truncate  |  
---------------------------------------+------------------------------------
 I'm sure this must have been reported before, but I can't find it in the
 bug tracker. The bug is that calling a vectorized function on a string
 type truncates the string to '|S8' regardless of the original length.

 Example:

 In [1]: import numpy

 In [2]: def __f(x):

    ...:     return x

    ...:

 In [3]: f = numpy.vectorize(__f)

 In [4]: s = '2011-07-04'

 In [5]: y = f(s)

 In [6]: y

 Out[6]:
 array('2011-07-04',
       dtype='|S10')

 In [8]: z = f(numpy.array([s,s,s,s]))

 In [9]: z
 Out[9]:
 array(['2011-07-', '2011-07-', '2011-07-', '2011-07-'],
       dtype='|S8')

 If this has been raised, please merge this in so I can track progress on
 the original.

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


More information about the NumPy-Tickets mailing list