我无法将statsmodel.api导入kaggle内核

时间:2019-06-29 05:56:02

标签: kaggle

我使用以下代码成功更新了kaggle内核中的statsmodels软件包:

!pip install statsmodels --upgrade

这给了我(0.10.0)的版本。但是,当我尝试导入statsmodels.api时,它给了我一个错误。

 import statsmodels.api as sm

我得到的错误是:

    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-7-3b8b7e2c2e57> in <module>
      8 import matplotlib.pyplot as plt
      9 from sklearn.preprocessing import Normalizer
---> 10 import statsmodels.api as sm
     11 
     12 # Input data files are available in the "../input/" directory.

/opt/conda/lib/python3.6/site-packages/statsmodels/api.py in <module>
     16 from . import robust
     17 from .robust.robust_linear_model import RLM
---> 18 from .discrete.discrete_model import (Poisson, Logit, Probit,
     19                                       MNLogit, NegativeBinomial,
     20                                       GeneralizedPoisson,

/opt/conda/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py in <module>
     43 
     44 from statsmodels.base.l1_slsqp import fit_l1_slsqp
---> 45 from statsmodels.distributions import genpoisson_p
     46 
     47 try:

/opt/conda/lib/python3.6/site-packages/statsmodels/distributions/__init__.py in <module>
      1 from statsmodels.tools._testing import PytestTester
      2 from .empirical_distribution import ECDF, monotone_fn_inverter, StepFunction
----> 3 from .edgeworth import ExpandedNormal
      4 from .discrete import genpoisson_p, zipoisson, zigenpoisson, zinegbin
      5 

/opt/conda/lib/python3.6/site-packages/statsmodels/distributions/edgeworth.py in <module>
      5 import numpy as np
      6 from numpy.polynomial.hermite_e import HermiteE
----> 7 from statsmodels.compat.scipy import factorial
      8 from scipy.stats import rv_continuous
      9 import scipy.special as special

ImportError: cannot import name 'factorial'

我已经升级了scipy软件包,但仍然出现相同的错误。我是Kaggle和Python的新手,我需要OLS函数来进行回归分析。我该如何解决这个问题?如果没有,我是否可以使用其他任何函数来获取回归摘要?

0 个答案:

没有答案