title: IndexError: only integers, slices (`:`), ellipsis (`...`), are valid indices
body: <p>I'm trying to define the following function but I think i'm making an error somewhere - </p>
  
  <pre><code>import numpy as np
  import math
  
  def banana(A,B,C1,C2,N,keep,init): 
  
  R = init*keep + N*keep
  x1=x2=0
  bimat = np.zeros((N,2))
  for r  in range(1,R+1):
      x1=np.random.normal((B*x2+C1)/(A*(x2**2)+1),math.sqrt(1/(A*(x2**2)+1)))
      x2=np.random.normal((B*x1+C2)/(A*(x1**2)+1),math.sqrt(1/(A*(x1**2)+1)))
      if (r&gt;init*keep and r%keep==0):
          mkeep=r/keep
          bimat[mkeep-init,:]=np.array([x1, x2])
  
  return(bimat)
  </code></pre>
  
  <p>When I pass some values into the function, for example - </p>
  
  <pre><code>banana(0.5,0,3,3,1000,10,10)
  </code></pre>
  
  <p>I get the following error - </p>
  
  <pre><code>IndexError                                Traceback (most recent call last)
  &lt;ipython-input-288-9d3d5702a1a0&gt; in &lt;module&gt;()
  ----&gt; 1 banana(0.5,0,3,3,1000,10,10)
  
  &lt;ipython-input-287-ac0004b13e9f&gt; in banana(A, B, C1, C2, N, keep, init)
        9         if (r&gt;init*keep and r%keep==0):
       10             mkeep=r/keep
  ---&gt; 11             bimat[mkeep-init,:]=np.array([x1, x2])
       12 
       13     return(bimat)
  
  IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis 
  (`None`) and integer or boolean arrays are valid indices
  </code></pre>
  
  <p>Does anyone know what might be causing it?</p>
  
  <p>Thanks!</p>