numpy - How can I find the max value between certain index values in an array (Python) -


this question has answer here:

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -