I have the following numpy ndarray, the shape is (4,1,2):
    myarray = np.array([[[0.,4.]],
                   [[1.,5.]],
                   [[2.,6.]],
                   [[3.,7.]]])
How do I find the max, min of each column? In this case min, max for 1st column is 0, 3; and min, max for 2nd column is 4, 7.
I can't quite figure out the correct syntax for np.amin and np.amax in this these cases.
Thanks.
import numpy as np
myarray = np.array([[[0., 4.]],
                    [[1., 5.]],
                    [[2., 6.]],
                    [[3., 7.]]])
maxes = np.max(myarray,axis=0)
mins = np.min(myarray,axis=0)
print 'maxes are :' ,maxes ,'\nmins are : ', mins
which gives:
maxes are : [[ 3.  7.]] 
mins are :  [[ 0.  4.]]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With