How to fix python error code -> cannot import name 'studentized_range' from 'scipy.stats'

3.1k Views Asked by At

I'm importing the following packages into Jupyter Lab and I keep getting an error whenever I try to import the "pingouin" library as follows:

import scipy.stats as stats
import seaborn as sns

from sklearn.linear_model import LinearRegression
from factor_analyzer import FactorAnalyzer 

import statsmodels.api as sm
import pingouin as pg

please note that I am using pingouin version 0.5.1 and scipy version 1.8.0 the Error message is this:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Input In [33], in <cell line: 25>()
     22 from factor_analyzer import FactorAnalyzer 
     24 import statsmodels.api as sm
---> 25 import pingouin as pg
     27 import warnings
     28 warnings.simplefilter(action='ignore', category=FutureWarning)

File ~\anaconda3\lib\site-packages\pingouin\__init__.py:14, in <module>
     12 from .correlation import *
     13 from .circular import *
---> 14 from .pairwise import *
     15 from .power import *
     16 from .reliability import *

File ~\anaconda3\lib\site-packages\pingouin\pairwise.py:12, in <module>
     10 from pingouin.effsize import compute_effsize, convert_effsize
     11 from pingouin.utils import (_check_dataframe, _flatten_list, _postprocess_dataframe)
---> 12 from scipy.stats import studentized_range
     14 __all__ = ["pairwise_ttests", "pairwise_tukey", "pairwise_gameshowell",
     15            "pairwise_corr"]
     18 @pf.register_dataframe_method
     19 def pairwise_ttests(data=None, dv=None, between=None, within=None, subject=None,
     20                     parametric=True, marginal=True, alpha=.05, alternative='two-sided',
     21                     padjust='none', effsize='hedges', correction='auto', nan_policy='listwise',
     22                     return_desc=False, interaction=True, within_first=True):

ImportError: cannot import name 'studentized_range' from 'scipy.stats' (C:\Users\Skafi\AppData\Roaming\Python\Python38\site-packages\scipy\stats\__init__.py)
0

There are 0 best solutions below