[SciPy-User] Extracting float vector from tuple vector

Joe Kington jkington@wisc....
Mon Oct 26 17:15:24 CDT 2009


Maybe I'm confused here, but doesn't "results['score']" give you what you
need?

On Mon, Oct 26, 2009 at 5:08 PM, Ian Stokes-Rees <
ijstokes@crystal.harvard.edu> wrote:

> 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.
>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20091026/04cd0d7b/attachment.html 


More information about the SciPy-User mailing list