Python
numpy

max and min method using numpy in more than 2 dimensions

print("====intro.====")
A = np.random.randint(0,9,30).reshape(5,6)
print(A)
print(A.max(axis=1))
print(A.min(axis=0))
  • e.g.
====intro.====
[[0 7 5 0 5 3]
 [5 1 6 4 3 4]
 [2 5 0 1 0 6]
 [8 2 1 8 3 6]
 [0 7 1 0 4 6]]
[7 6 6 8 7]
[0 1 0 0 0 3]