I am trying to take the following R statement and convert it to Python using NumPy:
1 + apply(tmp,1,function(x) length(which(x[1:k] < x[k+1])))
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 = -1 try: while 1: i = L.index(value, i+1) print "match at", i except ValueError: pass