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

Matti Viljamaa mviljamaa at kapsi.fi
Wed Aug 31 07:28:18 EDT 2016


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])




More information about the NumPy-Discussion mailing list