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

NumPy Trac numpy-tickets@scipy....
Sat Mar 26 13:23:48 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:             |  
-----------------------+----------------------------------------------------
Changes (by derek):

  * status:  new => needs_review
  * milestone:  => 1.6.0


Comment:

 Replying to [comment:1 fonnesbeck_chris]:
 > This seems like a pretty serious bug, from a usability standpoint. Is
 there another way of extracting the columns of an imported dataset in the
 meantime?

 Only after importing, I think - in the same manner that's done in the
 patch:

 {{{
 x = np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'), 'formats':
 ('S1', 'i4', 'f4')})
 a,b,c = (x[n] for n in x.dtype.names)
 }}}

 I felt a bit uneasy about this change first,since the structured array
 just _is_ 1-dimensional,
 but I agree now it would improve usability a lot, and actually provides a
 functionality you
 could not get the same way with
 {{{
 np.loadtxt(d).T
 }}}

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


More information about the NumPy-Tickets mailing list