[Numpy-discussion] genfromtxt - the return

Pierre GM pgmdevlist@gmail....
Tue Oct 6 22:23:57 CDT 2009


On Oct 6, 2009, at 11:01 PM, Skipper Seabold wrote:
>
> In keeping with the making some work for you theme, I filed an
> enhancement ticket for one change that we discussed and another IMO
> useful addition.  http://projects.scipy.org/numpy/ticket/1238
>
> I think it would be nice if we could do
>
> data = np.genfromtxt(SomeFile, dtype=float, names = ['var1', 'var2',
> 'var3' ...])
>
> So that float is paired with each variable name.  Also, the one that
> came up earlier of
>
> data = np.genfromtxt(SomeFile, dtype=(int, int, float), names =
> ['var1','var2','var3']
>
> I'm not completely convinced on this one though, since dtype =
> "i8,i8,f8" works.  I don't want know how much confusion it would add
> to have the dtype argument accept a non-valid dtype construction.

Actually, it's rather straightforward. I already have something that  
supports dtype=(int,int,float) (far easier to handle than "i4,i4,f8"),  
I need to tweak a couple of things when the names don't match before  
posting. Pairing the names with the dtype is pretty neat, that would  
be quite easy to implement



> PS.  Is it bad form for me to go ahead and assign these kinds of
> tickets to you if you're going to be working on them, or do you get
> pinged when any ticket is filed?

Go for it. I'm only notified when a ticket is assigned to me directly.



More information about the NumPy-Discussion mailing list