Q:

Print max from axis 0 and min from axis 1 from the following 2-D array using python programming

belongs to collection: Python NumPy Exercises

0

Print max from axis 0 and min from axis 1 from the following 2-D array.

sampleArray = numpy.array([[34,43,73],[82,22,12],[53,94,66]])

Expected Output:

Printing Original array
[[34 43 73]
 [82 22 12]
 [53 94 66]]

Printing amin Of Axis 1
[34 12 53]

Printing amax Of Axis 0
[82 94 73]

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

import numpy

print("Printing Original array")
sampleArray = numpy.array([[34,43,73],[82,22,12],[53,94,66]]) 
print (sampleArray)

minOfAxisOne = numpy.amin(sampleArray, 1) 
print("Printing amin Of Axis 1")
print(minOfAxisOne)

maxOfAxisOne = numpy.amax(sampleArray, 0) 
print("Printing amax Of Axis 0")
print(maxOfAxisOne)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Delete the second column from a given array and in... >>
<< Sort following NumPy array using python programmin...