How to get the maximum and minimum elements of NumPy 2d array columns in Python

1 Answer

0 votes
import numpy as np

arr2d = np.array([[4, 8, 2,  5], 
                  [6, 9, 7,  1], 
                  [2, 0, 5, 11]])

print(np.max(arr2d, axis=0))
print(np.min(arr2d, axis=0))





'''
run:

[ 6  9  7 11]
[2 0 2 1]

'''

 



answered Mar 26, 2023 by avibootz
...