import numpy as np test = np.array([np.arange(i, 44+i, dtype=np.int16) for i in range(56)]) np.percentile(test, (0.1, 0.99))