for j in range(n):
mn = B[0][j]
for i in range(n):
if B[i][j] < mn and B[i][j]>=0:
mn = B[i][j]
print(" %3d " % mn, end='')
print(list(map(lambda x: min([i for i in x if i > 0]), B)))
# import numpy as np
# B = np.array([[0, -1, 1], [2, 1, 2], [3, -1, -1]])
B[B <= 0] = B.max() # или можно B[B <= 0] = np.inf, если значения типа float
B.min(0)