title: Poisson Distribution fit
body: <p>i need to fit a Poisson distribution to a set of data:</p>
  
  <pre><code>fitfunc = lambda p, x: p[0]*pow(p[1],x)*pow(e,-p[1])/math.gamma(x+1) # Target function
  errfunc = lambda p, x, y: fitfunc(p, x) - y # Distance to the target function
  p0 = [1., 2.] # Initial guess for the parameters
  p1, success = optimize.leastsq(errfunc, p0[:], args=(bins_mean, n))
  </code></pre>
  
  <p>I made that using the example given in the <a href="http://wiki.scipy.org/Cookbook/FittingData" rel="nofollow">SciPy documentation</a>.</p>
  
  <p>If I comment the gamma function part, it works like a charm, so the problem is there, but I have no clue on how to solve it. </p>
  
  <p>I get the following error:</p>
  
  <pre><code>TypeError: can only concatenate list (not "int") to list
  </code></pre>
  
  <p>The input arguments of the fit are the output of plt.hist, i checked and the type is numpy ndarray</p>