Not able to pass an array into another array within a for loop
<p>I want to evaluate an expression inside for loop. I am doing:</p>

<pre><code>  for i in range(1,height+1):
    for j in range(1,width+1):
        y[i,j] = Q[img[i,j]+1]
</code></pre>

<p>but this returns an error saying </p>

<pre><code>     y[i,j] = Q[img[i,j]+1]
TypeError: 'numpy.ndarray' object is not callable
</code></pre>

<p>Thanks :)</p>

<p>Q(x) is trying to call Q with x as an argument.  Use Q[x] to access index x.</p>

<p>EDIT:</p>

<p>Your big block of code has the Q[x] syntax.  Do you still get the error message?</p>

python numpy matplotlib