I need to return the values (4, 0.51) for the max function and (7, -0.31) for the min function. I have been looking on the net for answers but I cannot get them to work.
From there, there must be a way to get the index of each value (as you would get a list index), but didn’t see it right away. I’ll look at the pyarray docs later.
Or, could you just sort the data in the dataset and grab the first and last rows? I’m not sure where your data comes from, so maybe that isn’t possible.
Or, as you iterate through your data, you could build two lists and then grab the min max values and their indexes. Something like this:
a=((2,5),(4,8),(0,-3))
m=[[],[]]
for i in a:
m[0].append(i[0])
m[1].append(i[1])
print a[m[1].index(min(m[1]))]
print a[m[1].index(max(m[1]))]