In this example we will show how to slice a NumPy array given a start and end index in Python.
Source Code
import numpy as np
n = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
# slice elements from index 3 to index 8 from the array
print(n[3:8])
Output:
[4 5 6 7 8]