[Numpy-discussion] loadtxt ndmin option

Pierre GM pgmdevlist at gmail.com
Tue May 31 11:18:43 EDT 2011


On May 31, 2011, at 4:53 PM, Derek Homeier wrote:

> Hi Chris,
> 
> On 31 May 2011, at 13:56, cgraves wrote:
> 
>> I've downloaded the latest numpy (1.6.0) and loadtxt has the ndmin  
>> option,
>> however neither genfromtxt nor recfromtxt, which use loadtxt, have it.
>> Should they have inherited the option? Who can make it happen?
> 
> you are mistaken, genfromtxt is not using loadtxt (and could not  
> possibly, since it has the more complex parser to handle missing  
> data); thus ndmin could not be inherited automatically.
> It certainly would make sense to provide the same functionality for  
> genfromtxt (which should then be inherited by [nd,ma,rec]fromtxt), so  
> I'd go ahead and file a feature (enhancement) request. I can't promise  
> I can take care of it myself, as I am less familiar with genfromtxt,  
> but I'd certainly have a look at it.

Oh, that shouldn't be too difficult: 'ndmin' tells whether the array must be squeezed before being returned, right ? You can add some test at the very end of genfromtxt to check what to do with the output (whether to squeeze it or not, whether to transpose it or not)... If you don't mind doing it, I'd be quite grateful (I don't have time to work on numpy these days, much to my regret). Don't forget to change the user manual as well...


More information about the NumPy-Discussion mailing list