Issue
I have numpy array such as np.array([2,2])
[[1,9],
[7,3]]
I want to get the max of third demention and make this into one dimension.
then numpy.array should be like this [9,7]
I think I can do this with for loop and make another numpy.
However it looks ackword, is there any good way to do this ?
Solution
amax function (alias is np.max
)
import numpy as np
a = np.array([[1,9],
[7,3]])
np.amax(a, axis=1)
# array([9, 7])
Answered By - svfat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.