I want to compare the elements of an array to a scalar and get an array with the maximum of the compared values. That's I want to call
import numpy as np
np.max([1,2,3,4], 3)
and want to get
array([3,3,3,4])
But I get
ValueError: 'axis' entry is out of bounds
When I run
np.max([[1,2,3,4], 3])
I get
[1, 2, 3, 4]
which is one of the two elements in the list that is not the result I seek for. Is there a Numpy solution for that which is fast as the other built-in functions?