[Numpy-discussion] Include last element when subindexing numpy arrays?

Robert Kern robert.kern at gmail.com
Wed Aug 31 08:22:54 EDT 2016


On Wed, Aug 31, 2016 at 12:28 PM, Matti Viljamaa <mviljamaa at kapsi.fi> wrote:
>
> Is there a clean way to include the last element when subindexing numpy
arrays?
> Since the default behaviour of numpy arrays is to omit the “stop index”.
>
> So for,
>
> >>> A
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
> >>> A[0:5]
> array([0, 1, 2, 3, 4])

A[5:]

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160831/1c3d0953/attachment.html>


More information about the NumPy-Discussion mailing list