min 

The tool min returns the minimum value along a given axis.

import numpy

my_array = numpy.array([[2, 5], 
                        [3, 7],
                        [1, 3],
                        [4, 0]])

print numpy.min(my_array, axis = 0)         #Output : [1 0]
print numpy.min(my_array, axis = 1)         #Output : [2 3 1 0]
print numpy.min(my_array, axis = None)      #Output : 0
print numpy.min(my_array)                   #Output : 0

By default, the axis value is None. Therefore, it finds the minimum over all the dimensions of the input array.    

 max 

The tool max returns the maximum value along a given axis.

import numpy

my_array = numpy.array([[2, 5], 
                        [3, 7],
                        [1, 3],
                        [4, 0]])

print numpy.max(my_array, axis = 0)         #Output : [4 7]
print numpy.max(my_array, axis = 1)         #Output : [5 7 3 4]
print numpy.max(my_array, axis = None)      #Output : 7
print numpy.max(my_array)                   #Output : 7

By default, the axis value is None. Therefore, it finds the maximum over all the dimensions of the input array.    

Task  

You are given a 2-D array with dimensions $N$X$\mbox{M}$. 

Your task is to perform the min function over axis $\mbox{I}$ and then find the max of that.

Input Format

The first line of input contains the space separated values of $N$ and $\mbox{M}$. 

The next $N$ lines contains $\mbox{M}$ space separated integers.

Output Format

Compute the min along axis $\mbox{I}$ and then print the max of that result. 

Sample Input
4 2
2 5
3 7
1 3
4 0

Sample Output
3

Explanation

The min along axis $\mbox{I}$ = $[2,3,1,0]$ 

The max of $[2,3,1,0]$ = $3$

Source: hackerrank | Difficulty: EASY


Solutions:
import numpy
(n, m) = list(map(int, input().split()))
arr = numpy.array([list(map(int, input().split())) for i in range(n)])
print(numpy.max(numpy.min(arr, axis=1), axis=0))


import numpy
(n, m) = map(int, input().split())
arr = []
for i in range(0, n):
	arr.append([int(x) for x in input().split()])
myarr = numpy.array(arr)
mini = numpy.min(myarr, axis=1)
print(numpy.max(mini))


import numpy
(n, _) = (int(i) for i in input().split())
a = numpy.array(tuple((input().split() for _ in range(n))), int)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(N, M) = list(map(int, input().split()))
l = numpy.array([input().split() for i in range(N)], int)
m = numpy.min(l, axis=1)
print(numpy.max(m))


import numpy as np
(n, m) = map(int, input().split(' '))
arr = np.array([input().split(' ') for i in range(n)], int)
print(np.max(np.min(arr, axis=1)))


import numpy as np
(N, M) = map(int, input().split())
matrix = np.empty((N, M), dtype=int)
for i in range(N):
	inp = input()
	matrix[i] = np.array(list(map(int, inp.split())))
result1 = np.min(matrix, axis=1)
result2 = np.max(result1, axis=None)
print(result2)


import numpy as np
import sys
(N, M) = list(map(int, sys.stdin.readline().split()))
A = np.array([sys.stdin.readline().split() for _ in range(N)], int)
print(np.max(np.min(A, axis=1)))


import numpy
(n, m) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for i in range(n)])
print(numpy.max(numpy.min(A, axis=1)))


import numpy as np
(n, m) = [int(i) for i in input().split()]
a = np.zeros((n, m), dtype='int32')
for i in range(m):
	a[i] = [int(j) for j in input().split()]
b = np.min(a, axis=1)
print(np.max(b))


import numpy
print(numpy.max(numpy.min(numpy.array([input().split() for _ in range(int(input().split()[0]))], int), axis=1)))


import numpy
(N, M) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for i in range(N)])
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(n, m) = map(int, input().strip().split())
arr = numpy.array([list(map(int, input().strip().split())) for line in range(n)])
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(n, m) = list(map(int, input().strip().split()))
arr = numpy.array([list(map(int, input().strip().split())) for i in range(n)])
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(N, M) = map(int, input().split())
a = []
for i in range(N):
	a.append(list(map(int, input().split())))
a = numpy.array(a)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)], int)
print(numpy.max(numpy.min(A, axis=1)))


import numpy
n = int(input().split()[0])
arr = numpy.array([input().split() for _ in range(n)], int)
print(numpy.max(numpy.min(arr, axis=1)))


import numpy as np
(N, M) = [int(i) for i in input().split()]
A = np.array([input().split() for _ in range(N)], int)
print(np.max(np.min(A, axis=1)))


import numpy
a = []
for _ in range(int(input().strip().split()[0])):
	a.append(list(map(int, input().strip().split())))
print(numpy.max(numpy.min(a, 1)))


import numpy
(n, m) = map(int, input().split())
l = []
for _ in range(n):
	l.append(list(map(int, input().split())))
arr = numpy.array(l)
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(N, M) = map(int, input().split())
l = numpy.array([input().split() for i in range(N)], int)
print(numpy.max(numpy.min(l, axis=1)))


import numpy
metrics = list(map(int, input().split()))
n = metrics[0]
m = metrics[1]
a = []
for i in range(n):
	var = list(map(int, input().split()))
	a.append(var)
a = numpy.array(a)
amin = numpy.min(a, axis=1)
print(numpy.max(amin))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)], int)
print(A.min(axis=1).max())


import numpy as np
l = list(map(int, input().split()))
array = []
for i in range(l[0]):
	array.append(list(map(int, input().split())))
np_array = np.array(array)
print(np.max(np.min(np_array, axis=1)))


import numpy as np
(n, m) = [int(e) for e in input().split()]
l = [input().split() for i in range(n)]
a = np.array(l, int)
print(np.max(np.min(a, axis=1)))


import numpy
(N, M) = map(int, input().split())
NP = numpy.array([list(map(int, input().split())) for i in range(N)])
print(numpy.max(numpy.min(NP, axis=1)))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for _ in range(N)])
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = list(map(int, input().split()))
ar = []
for i in range(n):
	tmp = list(map(int, input().split()))
	ar.append(tmp)
np_ar = numpy.array(ar)
print(numpy.max(numpy.min(np_ar, axis=1)))


import sys
import numpy as np

def main():
	f = open(sys.argv[1], 'r') if len(sys.argv) > 1 else sys.stdin
	(N, M) = (int(i) for i in f.readline().split())
	A = [[int(i) for i in f.readline().split()] for _ in range(N)]
	print(np.max(np.min(np.array(A), axis=1)))
	if f != sys.stdin:
		f.close()
main()


import numpy
(n, m) = [int(i) for i in input().strip().split()]
A = numpy.array([[int(i) for i in input().strip().split()] for j in range(n)])
print(numpy.max(numpy.min(A, 1)))


import numpy
(N, M) = list(map(int, input().split()))
A = numpy.array([input().split() for i in range(N)], int)
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = map(int, input().split())
a = numpy.array([[int(e) for e in input().split()] for i in range(n)])
b = numpy.min(a, axis=1)
print(numpy.max(b))


import numpy as np
(n, m) = tuple(map(int, input().split()))
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
a = np.array(a)
a = np.min(a, axis=1)
print(np.max(a))


import numpy
(n, m) = map(int, input().split())
arr = numpy.array([list(map(int, input().split())) for allvals in range(0, n)])
print(numpy.max(numpy.min(arr, axis=1)))


import numpy as np
(N, M) = [int(x) for x in input().split(' ')]
arr = []
for _ in range(N):
	arr.append([int(x) for x in input().split(' ')])
a = np.array(arr).reshape(N, M)
print(np.max(np.min(a, axis=1)))


import numpy as np
(N, M) = map(int, input().split())
arr = [list(map(int, input().split())) for i in range(N)]
print(np.max(np.min(arr, axis=1)))


from numpy import array, min, max
(N, M) = map(int, input().split())
num = array([list(map(int, input().split())) for _ in range(N)])
print(max(min(num, axis=1)))


import numpy as np
i = input().split()
arr = np.array([input().split() for _ in range(int(i[0]))], dtype=int)
print(np.max(np.min(arr, axis=1)))


import numpy
arr = []
for i in range(int(input().split()[0])):
	arr.append(list(map(int, input().split())))
a = numpy.array(arr, int)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for n in range(N)])
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = tuple((int(x) for x in input().split()))
arr = numpy.array(list((input().split() for i in range(n))), int)
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
i = [i for i in map(int, input().split())]
(N, M) = (i[0], i[1])
a = numpy.array([[i for i in map(int, input().split())] for j in range(N)])
a_min = numpy.min(a, axis=1)
a_min_max = numpy.max(a_min)
print(a_min_max)


import numpy
(n, m) = [int(x) for x in input().split()]
numbers = []
for _ in range(n):
	numbers.append([int(x) for x in input().split()])
numbers = numpy.array(numbers)
print(numpy.max(numpy.min(numbers, axis=1)))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)], int)
B = numpy.min(A, axis=1)
print(numpy.max(B))


import numpy
(N, M) = list(map(int, input().split()))
A = []
for i in range(N):
	A.append(list(map(int, input().split())))
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = map(int, input().strip().split())
a = []
for i in range(n):
	a.append(list(map(int, input().strip().split())))
a = numpy.array(a)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(n, m) = map(int, input().split())
print(numpy.max(numpy.min(numpy.array([input().split() for _ in range(n)], int), axis=1)))


import numpy
(N, M) = [int(x) for x in input().split()]
ll = []
for n in range(N):
	ll += [int(x) for x in input().split()]
a = numpy.array(ll).reshape(N, M)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(n, m) = map(int, input().split())
myarray = numpy.array([list(map(int, input().split())) for i in range(n)])
print(numpy.max(numpy.min(myarray, axis=1)))


import numpy as np
(n, m) = map(int, input().split())
lis = []
for i in range(n):
	lis.append(list(map(int, input().split())))
arr = np.array(lis)
print(np.max(np.min(arr, axis=1)))


import numpy as np
(n, m) = list(map(int, input().split()))
a = np.array([list(map(int, input().split())) for _ in range(n)])
print(np.max(np.min(a, axis=1)))


import numpy
(n, m) = [int(x) for x in input().split()]
a = []
for i in range(n):
	a.append([int(x) for x in input().split()])
a = numpy.array(a)
print(numpy.max(numpy.min(a, axis=1)))


import numpy as np
(n, m) = [int(x) for x in input().strip().split()]
array = np.array([[int(x) for x in input().strip().split()] for _ in range(n)])
print(np.max(np.min(array, axis=1)))


import numpy
(n, m) = map(int, input().split())
my_array = numpy.array([input().split() for _ in range(n)], int)
print(numpy.max(numpy.min(my_array, axis=1)))


import numpy
(n, m) = map(int, input().split())
my_array = numpy.array([list(map(int, input().split())) for i in range(n)])
print(numpy.max(numpy.min(my_array, axis=1)))


import numpy, re
print(numpy.max(numpy.min(numpy.array([[int(x) for x in input().strip().split()] for _ in range(int(re.search('\\d$', input().strip()).group(0)))]), axis=1)))


import numpy
(n, m) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for i in range(n)])
print(numpy.max(numpy.min(a, 1)))


import numpy
A = list()
(N, M) = map(int, input().split())
for i in range(N):
	A.append(input().split())
ListA = numpy.array(A, int)
print(numpy.max(numpy.min(ListA, axis=1)))


import sys
import numpy as np
(n, m) = [int(x) for x in input().split()]
my_list = []
for _ in range(n):
	my_list.append([int(x) for x in input().split()])
my_array = np.array(my_list, dtype=int)
my_min = np.min(my_array, axis=1)
print(np.max(my_min))


import operator
import numpy

def read_f(f):
	return f(input())

def read_f_words(f):
	return mapl(f, input().split())

def mapl(f, x):
	return list(map(f, list(x)))

def read_a(f, n):
	ns = []
	for x in range(n):
		ns.append(read_f_words(f))
	return numpy.array(ns, f)
nm = read_f_words(int)
(n, m) = nm
a = read_a(int, n)
print(numpy.max(numpy.min(a, axis=1)))


import numpy as np
(N, M) = map(int, input().split())
a = np.zeros((N, M), int)
for i in range(N):
	a[i] = tuple(map(int, input().split()))
print(max(np.min(a, axis=1)))


import numpy
(n, m) = (int(i) for i in input().split())
l = []
for _ in range(n):
	l.append(input().split())
print(numpy.max(numpy.min(numpy.array(l, int), axis=1)))


import numpy
(n, m) = map(int, input().split(' '))
a = numpy.array([input().split(' ') for _ in range(n)], int)
print(numpy.max(numpy.min(a, axis=1)))


import numpy as np
[N, M] = list(map(int, input().split()))
L1 = []
for i in range(N):
	L1.append(list(map(int, input().split())))
npArr = np.array(L1)
print(np.max(np.min(npArr, axis=1)))


import numpy
(n, m) = [int(a) for a in input().split()]
arr = numpy.array([input().split() for a in range(n)], int)
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(N, M) = map(int, input().strip().split())
A = numpy.array([list(map(int, input().strip().split())) for x in range(N)], int)
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(N, M) = map(int, input().split())
print(numpy.max(numpy.min(numpy.array([list(map(int, input().split())) for _ in range(N)]), axis=1)))


import numpy
a = numpy.array(input().split(), int)
b = numpy.array([numpy.array(input().split(), int) for i in range(a[0])])
print(numpy.max(numpy.min(b, axis=1)))


import numpy
(n, m) = map(int, input().split())
arrays = list()
for i in range(n):
	arrays.append(list(map(int, input().split())))
my_array = numpy.array(arrays)
print(numpy.max(numpy.min(my_array, axis=1)))


import numpy
(n, m) = tuple(map(int, input().strip().split()))
arr = numpy.array([list(map(int, input().strip().split())) for _ in range(n)])
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(n, m) = [int(x) for x in input().split()]
A = []
for _ in range(n):
	A.append([int(x) for x in input().split()])
A = numpy.array(A, int)
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = map(int, input().split())
lista = [list(map(int, input().split())) for i in range(n)]
ar = numpy.array(lista)
print(max(numpy.min(ar, axis=1)))


import numpy as np
(n, m) = map(int, input().split())
a = np.fromstring(' '.join([input() for _ in range(n)]), sep=' ', dtype=int).reshape(n, m)
print(a.min(1).max())


import numpy
(N, M) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for _ in range(N)])
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(n, m) = map(int, input().split())
print(numpy.max(numpy.min(numpy.array([list(map(int, input().split())) for _ in range(n)]), axis=1)))


import numpy as np
(n, m) = map(int, input().split())
a = np.array([list(map(int, input().split())) for _ in range(n)])
a = a.min(axis=1)
print(np.max(a))


import numpy as np

def main():
	(n, m) = map(int, input().split())
	l = []
	for _ in range(n):
		l.append(list(map(int, input().split())))
	l = np.array(l)
	print(np.max(np.min(l, axis=1)))
main()


import numpy
(N, M) = [int(x) for x in input().split()]
L = []
for i in range(N):
	L.append([int(x) for x in input().split()])
A = numpy.array(L)
M = numpy.min(A, axis=1)
print(numpy.max(M))


import numpy as np
(n, m) = (int(x) for x in input().split(' '))
a = np.array([[int(x) for x in input().split()] for _ in range(n)])
print(a.min(axis=1).max())


import numpy as np
(n, m) = list(map(int, input().split()))
arr1 = []
for i in range(0, n):
	temp = list(map(int, input().split()))
	arr1.append(temp)
npa = np.array(arr1)
npa = np.min(npa, axis=1)
print(np.max(npa))


import numpy
(n, m) = map(int, input().split())
l = list()
for _ in range(n):
	l.append(list(map(int, input().split())))
a = numpy.array(l)
a1 = numpy.min(a, axis=1)
print(numpy.max(a1))


import numpy
(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.extend(list(map(int, input().split())))
a = numpy.array(a)
a.shape = (n, m)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
A = numpy.array([numpy.array(input().split(), int) for _ in range(int(input().split()[0]))])
print(numpy.max(numpy.min(A, axis=1)))


import numpy
(n, m) = map(int, input().split())
a = []
for _ in range(n):
	a.append(list(map(int, input().split())))
a = numpy.array(a)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
(n, m) = map(int, input().split())
l = []
for i in range(m):
	l.append(list(map(int, input().split())))
k = numpy.min(l, axis=1)
print(numpy.max(k))


import numpy
(n, _) = map(int, input().split())
array = numpy.array([list(map(int, input().split())) for _ in range(n)])
print(numpy.max(numpy.min(array, axis=1)))


import numpy
(n, m) = [int(e) for e in input().split()]
arr = []
for _ in range(n):
	arr.append([int(e) for e in input().split()])
arr = numpy.array(arr, dtype=int)
print(numpy.max(numpy.min(arr, axis=1)))


import numpy
(n, m) = map(int, input().split())
data = numpy.array([input().split() for _ in range(n)], int)
print(numpy.max(numpy.min(data, axis=1)))


import numpy as np
print(np.max(np.min(np.array([list(map(int, input().split())) for _ in range(int(input().split()[0]))]), axis=1)))


from numpy import array, min, max
(N, M) = map(int, input().strip().split())
A = array([[int(i) for i in input().strip().split()] for _ in range(N)])
print(max(min(A, axis=1)))


import numpy as np
(n, m) = map(int, input().split())
mat = np.array([[int(x) for x in input().split()] for _ in range(n)])
print(np.max(np.min(mat, axis=1)))


import numpy
dims = tuple(map(int, input().split(' ')))
data = [numpy.array(input().split(' '), int) for i in range(dims[0])]
print(numpy.max(numpy.min(data, axis=1)))


import numpy
(n, m) = map(int, input().split())
A = [0] * n
for i in range(n):
	A[i] = list(map(int, input().split()))
A = numpy.array(A, int)
A = numpy.min(A, axis=1)
res = numpy.max(A)
print(res)


import numpy
print(numpy.max(numpy.min(numpy.array([[int(x) for x in input().split()] for _ in range(int(input().split()[0]))]), axis=1)))


import numpy
(n, m) = map(int, input().split())
a = numpy.array([input().split() for i in range(n)], int)
print(numpy.max(numpy.min(a, axis=1)))


import numpy
mojir = input()
hyo = mojir.split(' ')
N = int(hyo[0])
M = int(hyo[1])
motoarr = []
for idx in range(0, N, 1):
	mojir = input()
	hyo = mojir.split(' ')
	yokovec = [int(mono) for mono in hyo]
	motoarr.append(yokovec)
arr = numpy.array(motoarr)
totyuuvec = numpy.min(arr, axis=1)
print(numpy.max(totyuuvec))


import numpy
(N, M) = map(int, input().split())
my_array = numpy.array([input().split() for i in range(N)], int)
ma_min = numpy.min(my_array, axis=1)
print(numpy.max(ma_min))