I have an array,
a = np.array([[0,9,8],[5,6,4]])
how to replace the each array in axis 1 with the max value of its array?
excepting output- a = np.array([9,6])
where 9 is the max value in [0,9,8] and 6 is the max value in [5,6,4]
thanks
I have an array,
a = np.array([[0,9,8],[5,6,4]])
how to replace the each array in axis 1 with the max value of its array?
excepting output- a = np.array([9,6])
where 9 is the max value in [0,9,8] and 6 is the max value in [5,6,4]
thanks
You should use
np.max(a, axis=1)
Link to documentation