[NumPy-Tickets] [NumPy] #1458: loadtxt doesn't unpack structred arrays with unpack=True

NumPy Trac numpy-tickets@scipy....
Sat Apr 2 20:45:32 CDT 2011


#1458: loadtxt doesn't unpack structred arrays with unpack=True
-----------------------+----------------------------------------------------
 Reporter:  gdub       |       Owner:  somebody    
     Type:  defect     |      Status:  needs_review
 Priority:  high       |   Milestone:  1.6.0       
Component:  numpy.lib  |     Version:  devel       
 Keywords:             |  
-----------------------+----------------------------------------------------

Comment(by charris):

 The returned values aren't necessarily in the same order as the specified
 names. Unless that can be fixed this functionality would seem to lose much
 of its usefulness. Apply the patch, then do

 {{{
 txt = StringIO(asbytes("M 21 72\nF 35 58"))
 dt = { 'names': ('a', 'b', 'c'), 'formats': ('S1', 'i4', 'f4')}
 a, b, c = np.loadtxt(txt, dtype=dt, unpack=True)
 }}}

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


More information about the NumPy-Tickets mailing list