There is a function in my program that does the split and float. Then pass the matrix to main program. Now I have a function to find the row and column with the minimum value. With the help of Martijn Pieters, I was able to get the min value but the pair. Example of output is given below. E is the square matrix that is passed to this function from main.
Values are stored in txt file and read in separate function and the matrix is passed to main. From their matrix is passed to the function below.
0 2 8 9
2 4 9 9
4 7 4 8
3 4 8 9
code:
def closest_pair(e):
'''for row in range(len(e)):
for col in range(0,len(row),1):
minrow = min(e[row])
mincol = min(e[col])
return ([minrow], [mincol])'''
result = min((min((v, c) for c, v in enumerate(row)), r) for r, row in enumerate(e))
return result[1], result[0][1]
This helped me to find the min value of row and column however the output was to get the pair. Also for the first value which would be 0, 0 would not count thus if the value for (0, 0) is 0 then that doesn't count as being the min value. With that said, for instance if row 1 and column 1, value is [2,2] as pair and are the only minimum pair than the output would (1,1).