[NumPy-Tickets] [NumPy] #1444: numpy.array fails to change a list of tuples with float and string, whith to large string of number

NumPy Trac numpy-tickets@scipy....
Thu Apr 1 04:19:34 CDT 2010


#1444: numpy.array fails to change a list of tuples with float and string, whith
to large string of number
------------------------------------+---------------------------------------
 Reporter:  mario                   |       Owner:  somebody
     Type:  defect                  |      Status:  new     
 Priority:  normal                  |   Milestone:  1.4.0   
Component:  Other                   |     Version:          
 Keywords:  array str float lenght  |  
------------------------------------+---------------------------------------
 In [39]: c
 Out[39]:
 [(-0.017527029320000002, 'TD_C3_0.440sec'),
  (9.0204180442999995e-06, 'TD_C3_0.920sec')]

 In [40]: numpy.array(c)
 Out[40]:
 array([['-0.01752702932', 'TD_C3_0.440sec'],
        ['9.0204180443e-', 'TD_C3_0.920sec']],
       dtype='|S14')

 So it seems that the length of the number is restricted by the lenght of
 the string. Proof:
 In [71]: e=[]

 In [72]: e.append((a,'TD_C3_0.920second'))

 In [73]: e.append((b,'TD_C3_0.920sec'))

 In [74]: numpy.array(e)
 Out[74]:
 array([['9.0204180443e-06', 'TD_C3_0.920second'],
        ['-0.01752702932', 'TD_C3_0.920sec']],
       dtype='|S17')

  A way out was to set the dtype to '|S17' but thats no real solution.

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


More information about the NumPy-Tickets mailing list