Код: Выделить всё
import numpy as np
arr = np.array([0, 10, 20, 30, 40, 50, 29999999])
M = np.max(arr)
# slice based on indices
s = slice(2, None)
print(arr[s])
# slice based on values
s = slice(20, None)
i = range(*s.indices(M + 1))
print(arr[np.isin(arr, i)]) # inefficient!
Код: Выделить всё
[ 20 30 40 50 29999999]
[ 20 30 40 50 29999999]
Подробнее здесь: https://stackoverflow.com/questions/786 ... dices-in-a