in my python code i am trying to find the values in tv and px that correspond to the index of the minimum value larger than 10 in py after the max has been reached. This is the code I have written, but I am getting a type error for the line new_py = py[k:] saying "only integer scalar arrays can be converted to a scalar index"
: tv = np.array( [0.6, 0.7, 1.5, 1.6, 1.7, 1.8, 1.9]) pX = np.array([2.4, 2.9, 5.7, 6.6, 7.5, 8.4, 9.3]) py = np.array([9.7, 10.1, 10.5, 10.2, 10.1, 9.9, 9.8]) Y_max_value = max(py) max_index = np.where(py == y_max_value) k = max_index [0] new_py = py[k:] min_val = min(i for i in new_py if i >= 10) min_index = np.where(py == min_val) print(px [min_index]) print(tv (min_index])

Q&A Education