How do I import the frechet_r function from the scipy library?

22 views Asked by At

When I try to import the function into the library the following error appears:

from scipy.stats import frechet_r
ImportError: cannot import name 'frechet_r' from 'scipy.stats' (C:\Users\melqu\anaconda3\lib\site-packages\scipy\stats\__init__.py)

I tried calling the function as follows

from scipy.stats import frechet_r

Is this way of importing correct?

I've already tried uninstalling and reinstalling scipy, updating pip, among other suggestions

1

There are 1 answers

0
Nick ODell On

The distributions frechet_r and frechet_l were renamed in SciPy version 1.6.0.

They were renamed because they were confusing. The frechet_r function was an implementation of the Weibull distribution, which was historically known as a Frechet distribution.

SciPy issue #3258 explains the rationale for the change.

To fix this, three things were done:

  1. frechet_r was renamed to weibull_min.
  2. frechet_l was renamed to weibull_max.
  3. A new function, invweibull was created. This distribution implements the more common meaning of "Frechet distribution."

To replace these, you can use one of these three functions, depending on which behavior you want.