import numpy as np def my_func(x): left = np.where(x[:-1]>0)[0][-1] right = 1 + np.where(x[1:]<0)[0][0] return x[left], x[right]. Demo: >>> a = np.array([10 ...
確定! 回上一頁