In this example we will show how to slice a NumPy array by giving an end index but omitting a start 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 the beginning to index 8 (not included)
print(n[:8])
Output:
[1 2 3 4 5 6 7 8]