python - Referencing numpy array locations within if statements -


i have following section of python:

for j in range(0,t):     x in xrange(len(index)):         y in xrange(x+1,len(index)):             if index(y) == index(x):              continue 

for have been attempting translate matlab equivalent. in matlab, operation simple follows:

    iter = 1:t     = 1:length(index)     j = i+1:length(index)         if index(j) == index(i)             continue;         end 

however, when attempt execute code receive "numpy.ndarray object not callable" error. why arise, , how go writing in proper python manner execute?

looks index array of sort, when index(y) , index(x), python thinks you're trying call function index() using x , y parameters, respectively.

if you're trying access elements, use index[x] , index[y].


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -