lmoments3 and scipy (again)

Kyle Stanley aeros167 at gmail.com
Wed Oct 14 02:47:57 EDT 2020


Based on a search of the scipy docs, it looks like the function might have
moved namespaces from scipy.misc.comb to scipy.special.comb (
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.comb.html?highlight=comb#scipy-special-comb)
when referenced in lmoments3. Alternatively, if you clone the package from
the repo directly, it seems to have been addressed in a recent commit:
https://github.com/OpenHydrology/lmoments3/commit/3349b90463f649aea02be5dc3726d22e5e500dc3
.

On Wed, Oct 14, 2020 at 12:00 AM David Painter <david at dpconsulting.co.nz>
wrote:

> I'm aware there have been problems with previous versions of
> lmoments3 working with scipy -- comb having been replaced in scipy. I
> thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
> would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
> verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
> traceback referring to attribute comb not being present in
> module scipy.misc.
> Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license()" for more information.
> >>> import numpy
> >>> import scipy
> >>> import lmoments3
> >>> from lmoments3 import distr
> >>> data = [135.2 ,130.1 ,117 ,109.3 ,92.1 ,91.4 ,83.1 ,80.5 ,74.7
> ,69.8,65.2,58.6,56.5,55.4,54.6,54.5,49.5,48.9,48.3,46.6]
> >>> paras = distr.gpa.lmom_fit(data)
> Traceback (most recent call last):
>   File "<pyshell#5>", line 1, in <module>
>     paras = distr.gpa.lmom_fit(data)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py",
> line 59, in lmom_fit
>     lmom_ratios = lm.lmom_ratios(data, nmom=n_min)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 82, in lmom_ratios
>     return _samlmusmall(data, nmom)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 159, in _samlmusmall
>     l1 = np.sum(x) / sm.comb(n, 1, exact=True)
> AttributeError: module 'scipy.misc' has no attribute 'comb'
>
> What am I doing wrong?
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list