标签: python numpy
可能重复: Running maximum of numpy array values
是否有内置的numpy功能可以做到这一点?
def peak_track(array): max = 0 max_array = np.zeros_like(array) for i, val in enumerate(array): if val > max: max = val max_array[i] = max return max_array