numpy - How can I find the max value between certain index values in an array (Python) -
this question has answer here:
- explain slice notation 24 answers
if have array in python:
a = np.array([20, 21, 19, 85, 25, 31, 21, 99, 3])
and want find max value between indices 2 , 5 return 85. how can this?
i know a.max()
output value 99, not sure how specify range.
just use slicing.
a = np.array([20, 21, 19, 85, 25, 31, 21, 99, 3]) a[2:5].max()
gives 85 max value.
Comments
Post a Comment