title: How do I calculate expected values of a Poisson distributed random variable in Python using Scipy?
body: <p>I want to calculate an expected value of a function of a Poisson distributed random variable using Scipy. </p>
  
  <pre><code>import scipy.stats as stats
  from scipy.stats import poisson, norm
  
  G = poisson(mu=30)
  G.dist.expect(func=lambda x:(x+1), lb=0, ub=np.inf, *G.args, **G.kwds)    
  </code></pre>
  
  <p>This results in an error: </p>
  
  <blockquote>
    <p>File "ipython-input-3-da8a2a80eba8", line 2, in module
    G.dist.expect(func=lambda x:(x+1), lb=0, ub=np.inf, *G.args, **G.kwds)</p>
    
    <p>TypeError: expect() got an unexpected keyword argument 'mu'</p>
  </blockquote>
  
  <p>If I try the same with a normal random variable</p>
  
  <pre><code>F = norm(loc=100,scale=30) 
  F.dist.expect(func=lambda x:(x+1), lb=0, ub=np.inf, *F.args, **F.kwds)  
  </code></pre>
  
  <p>the code works and returns 101.0029332762359. </p>
  
  <p>How should I correctly define the r.v. G so that I can compute the expectation using any function? I use Python 2.7.8 (default, Jul 26 2014, 15:25:14), IPython 2.1.0.</p>
  
  <p>Best Wishes, Johannes</p>