Python equivalent of which() in R
The Python code below answers my question:
np.array([1 + np.sum(row[range(k)] < row[k]) for row in tmp])
Here tmp is a 2d array, and k is a variable which was set for column comparison.
Thanks to https://stackoverflow.com/users/601095/doboy for inspiring me with the answer!
From http://effbot.org/zone/python-list.htm:
To get the index for all matching items, you can use a loop, and pass in a start index:
i = -1try: while 1: i = L.index(value, i+1) print "match at", iexcept ValueError: pass