[Numpy-discussion] How do I get element on axis 1

Vishal Rana ranavishal@gmail....
Fri Apr 2 16:49:55 CDT 2010


Thanks Warren!


On Fri, Apr 2, 2010 at 2:46 PM, Warren Weckesser <
warren.weckesser@enthought.com> wrote:

> Vishal Rana wrote:
> > Hi,
> >
> > I know its easy, but I am not just getting it...
> >
> > How do I get last element on axis=1 for:
> >
> > a = array([[ 0,  1,  2,  3,  4],
> >        [ 5,  6,  7,  8,  9],
> >        [10, 11, 12, 13, 14],
> >        [15, 16, 17, 18, 19],
> >        [20, 21, 22, 23, 24]])
> >
> > Expected: array([4, 9, 14, 19, 24])
> >
>
> a[:,-1]
>
> > Thanks
> > Vishal Rana
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
>
> _______________________________________________
> 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/20100402/1f80db0b/attachment.html 


More information about the NumPy-Discussion mailing list