[SciPy-User] Extracting float vector from tuple vector

Ian Stokes-Rees ijstokes@crystal.harvard....
Mon Oct 26 17:08:42 CDT 2009


Take 3 at sending this:

> I have a vector that is defined as follows:
>
>    dtype   = [("score", "f4"), ("rfac", "f4"), ("codefull", "a10"), 
> ("code2", "a2"), ("subset","a4"), ("source","a10")]
>    results = np.zeros((entry_count,), dtype=dtype)
>
> What I'd love to be able to do is to refer to a "slice" taken from a 
> selection of rows, and only one tuple entry, e.g.:
>
> results[:]["score"]
>
> would return a vector of "f4" floats only, from the first entry of 
> every tuple in results.
>
> I can't figure out how to do this!
>
> Any suggestions gratefully received.





More information about the SciPy-User mailing list