I want to compare the elements of an array with a scalar and get an array with the maximum number of compared values. What 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 started
np.max([[1,2,3,4], 3])
I get
[1, 2, 3, 4]
which is one of the two elements on the list, which is not the result I was aiming for. Is there a Numpy solution for fast, like other built-in functions?
source share