[Numpy-discussion] Another dumb structured array question

Ralf Gommers ralf.gommers@googlemail....
Wed Sep 30 10:01:34 CDT 2009


On Wed, Sep 30, 2009 at 10:24 AM, Skipper Seabold <jsseabold@gmail.com>wrote:

> On Wed, Sep 30, 2009 at 9:51 AM, Travis Oliphant <oliphant@enthought.com>
> wrote:
> >
> > On Sep 29, 2009, at 3:32 PM, David Warde-Farley wrote:
> >
> >> Is there an easy way to get multiple subdtypes out? e.g. if I have a
> >> dtype
> >>
> >> dtype([('foo', 'i4'), ('bar', 'i8'), ('baz', 'S100')])
> >>
> >> and an array with that dtype, is there a way to only get the 'foo' and
> >> 'bar'?
> >>
> >> arr[('foo','bar')] doesn't seem to work.
> >
> > Try  (with a later version of NumPy --- possibly trunk):
> >
> > arr[['foo', 'bar']]
> >
> > (i.e. with a list instead of a tuple)
> >
>
> That's really helpful to know.  Is it too early to document this on
> the wiki <http://docs.scipy.org/doc/numpy/user/basics.rec.html>?
>

Not at all. If it works in trunk it can be documented here:
http://docs.scipy.org/numpy/docs/numpy-docs/user/basics.rec.rst/

Cheers,
Ralf


> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090930/00426735/attachment.html 


More information about the NumPy-Discussion mailing list