On Tue, May 31, 2011 at 10:33 AM, Bruce Southey <[email protected]> wrote:
> On 05/31/2011 10:18 AM, Pierre GM wrote: > > 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... > > _______________________________________________ > > NumPy-Discussion mailing list > > [email protected] > > http://mail.scipy.org/mailman/listinfo/numpy-discussion > (Different function so different ticket.) > > Sure you can change the end of the code but that may hide various > problem. Unlike loadtxt, genfromtxt has a lot of flexibility especially > handling missing values and using converter functions. So I think that > some examples must be provided that can not be handled by providing a > suitable converter or that require multiple assumptions about input file > (such as having more than one delimiter). > > Bruce > At this point, I wonder if it might be smarter to create a .atleast_Nd() function and use that everywhere it is needed. Having similar logic tailored for each loading function might be a little dangerous if bug fixes are made to one, but not the others. Ben Root
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
