[NumPy-Tickets] [NumPy] #2172: Make .squeeze() an option for genfrontxt()

NumPy Trac numpy-tickets@scipy....
Tue Jun 19 11:08:39 CDT 2012

#2172: Make .squeeze() an option for genfrontxt()
 Reporter:  lmeyn   |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  1.6.1      
 Keywords:          |  
 I'm trying to read several data files with column headers using
 numpy.genfromtxt. The issue is that some of the data files only have one
 row of data and squeeze operation  used in genfromtxt returns an object
 with no rows (shape = () ). I would suggest adding an argument,
 squeeze=True, and the replace the last three lines

     if unpack:
         return output.squeeze().T
     return output.squeeze()


     if squeeze:
         output = output.squeeze()
     if unpack:
         return output.T
     return output

 This would keep the current behavior if the squeeze argument isn't
 specified, yet allow the squeeze operation to be avoided if desired.

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

More information about the NumPy-Tickets mailing list