[SciPy-user] Question about scipy.stats

Jesús Carrete Montaña kuantiko at escomposlinux.org
Tue May 1 08:58:13 EDT 2007


Hi to all,

   I get the following error when trying to evaluate the probability 
density function for a Poisson distribution:

from scipy import *

d2=stats.poisson(loc=1.,scale=2.)
x=arange(1,10,1)
d2.pdf(x)

---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most 
recent call last)

/home/kuantiko/latex/2006-2007/lFNyP/memoria/<ipython console>

/usr/lib/python2.4/site-packages/scipy/stats/distributions.py in 
pdf(self, x)
    104         self.dist = dist
    105     def pdf(self,x):
--> 106         return self.dist.pdf(x,*self.args,**self.kwds)
    107     def cdf(self,x):
    108         return self.dist.cdf(x,*self.args,**self.kwds)

AttributeError: poisson_gen instance has no attribute 'pdf'

   Perhaps I'm using this module incorrectly, but I've noticed that te 
same code works with a gaussian distribution:

d1=stats.norm(loc=1.,scale=2.)
d1.pdf(x)
Out[12]:
array([ ... ])

   Is it a bug or am I missing something? I am using Scipy hversion 
0.5.2 on Debian Sid.

Thanks,

Jesús



More information about the SciPy-User mailing list