So I made this function to find what the max value of "column" is in my 2d-list, which returns the max value of my said column in my list, but this said max value actually appears twice, so how do I return the indexes/rows where this max value appears?
def find_max(column): maxVal = 0 for i in range(1, len(lst)): maxVal = max(maxVal, int(lst[i][column])) return (maxVal)
I feel so lost, but i've been trying something like this.... v (obv not working atm, just brainstorming)
def test(column): maxVal = 0 year =  for i in range(1, len(lst)): if maxVal == int(lst[i][column]): year.append(lst[i]) else: maxVal = max(maxVal, int(lst[i][column])) year = (lst[i]) year.extend(maxVal) return year #so column 0 is years, and I want to save the years where my X column had the biggest value(s).
And lets say the column I'm looking for is the third (or index 2), so I have the max value of 27 on row 36 & 38, how do I return these indexes? (What im actually looking for is what the value on first column is, 2004 & 2006)