[Numpy-discussion] Extracting data from genfromtxt?

Rohaq rohaq@dearinternet....
Sat Mar 19 09:58:41 CDT 2011


On Sat, Mar 19, 2011 at 01:52, Ben Gamari <bgamari.foss@gmail.com> wrote:

> On Fri, 18 Mar 2011 20:27:17 +0000, Rohaq <rohaq@dearinternet.com> wrote:
> > There could be a lot more than 2 other columns, Result3,Result4, etc.,
> > so I need to code it to be scalable; if this were acting like a normal
> > dict, I could write a loop that iterates over the keys, and loads the
> > results data into a new object, but I can't seem to find a function
> > that will return the keys so that I can do this.
> >
> You could also iterate over data.dtype.fields, which will behave much
> like dict.keys().
>
> - Ben
>

Actually I just found last night I could iterate over data.dtype.names, and
unlike fields, it seems to print them in the order of the columns from the
CSV file :)

Thanks for your help though!

-- 
Rohaq
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110319/551d9989/attachment.html 


More information about the NumPy-Discussion mailing list