[SciPy-user] Difficulties with gaussian_kde

David Huard david.huard at gmail.com
Mon Dec 12 11:10:16 CST 2005


I'm trying to use gaussian_kde but it returns an error. Here's the code

from scipy.stats import gaussian_kde, norm
x = norm.rvs(10,2,size = 100)
ckde = gaussian_kde(x)

returning the message :

  File "/usr/lib/python2.4/site-packages/scipy/stats/kde.py", line 91, in
    points = atleast_2d(points).astype(self.dataset.typecode())
AttributeError: 'scipy.ndarray' object has no attribute 'typecode'

when trying resample(size = 10), I get

  File "mtrand.pyx", line 837, in mtrand.RandomState.multivariate_normal
AttributeError: 'module' object has no attribute

I'm using a version of scipy obtained from svn last week. Since I'm a newbie
to Python and Scipy, I have the nagging feeling that I am missing something
trivial here. Am I ?


David Huard

If I may suggest, I would add a first line in the docstring of
kde.pydescribing how to call gaussian_kde, something as
""" Uni/multi-variate kernel density estimation.  gaussian_kde(dataset) ->
class object

the rest of the docstring is pretty straighforward but the first step is
taken for granted, and since it returned errors, I had serious doubts as to
how the class had to be called.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20051212/b0b85256/attachment.htm

More information about the SciPy-user mailing list