[SciPy-user] Error in scipy.stats.poisson

Robert Kern robert.kern@gmail....
Wed Aug 29 11:18:42 CDT 2007


John Reid wrote:
> Hi,
> 
> Should the following code work?
> 
> import scipy.stats as S
> r=S.poisson(4)
> r.pdf(2)
> 
> 
> I get the following error:
> C:\apps\Python25\Lib\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)
> 
> <type 'exceptions.AttributeError'>: poisson_gen instance has no 
> attribute 'pdf'
> 
> S.poisson does have a pmf function not a pdf function. Is this the cause?

Yes. Discrete distributions have Probability Mass Functions, not Probability
Density Functions.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco


More information about the SciPy-user mailing list