title: Calculate the percentage internal rate of return
body: <p>Following is the code I am trying to use to get my result, and I am getting an error:</p>
  
  <pre><code>import numpy
  
  array = [-1000,0,0,1094.60,0,0,1094.60]
  
  for b in array:
      a = round(numpy.irr(array), b-1) * 100 
  print (round(a,2))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>TypeError: 'float' object cannot be interpreted as an integer
  </code></pre>
  
  <p>But, just replacing that "b-1" makes my code work, but I can't use that because array could be as large or as small as possible. I am not allowed to manually enter numbers replacing that "b-1". Following is the same working code.</p>
  
  <pre><code>import numpy
  
  array = [-1000,0,0,1094.60,0,0,1094.60]
  
  for b in array:
      a = round(numpy.irr(array), 6) * 100 
  print (round(a,2))
  </code></pre>
  
  <p>I need a way to do it automatically for any size of array.</p>