Is there a function in the numpy API that finds the maximum values of an array like this?
def fun_max(array,axis=None): return [max(array[:i+1]) for i in range(len(array))] a=[3,4,2,1,5] print(fun_max(a)) output:
[3,4,4,4,5] Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack InternalIs there a function in the numpy API that finds the maximum values of an array like this?
def fun_max(array,axis=None): return [max(array[:i+1]) for i in range(len(array))] a=[3,4,2,1,5] print(fun_max(a)) output:
[3,4,4,4,5]