seaborn: one kdeplot function error of seaborn

when I run the demo Example:

>>> import numpy as np; np.random.seed(10)
>>> import seaborn as sns; sns.set(color_codes=True)
>>> mean, cov = [0, 2], [(1, .5), (.5, 1)]
>>> x, y = np.random.multivariate_normal(mean, cov, size=50).T
>>> ax = sns.kdeplot(x)

it report an error as below:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python\Python35\lib\site-packages\seaborn\distributions.py", line 604, in kdeplot
    cumulative=cumulative, **kwargs)
  File "D:\Python\Python35\lib\site-packages\seaborn\distributions.py", line 270, in _univariate_kdeplot
    cumulative=cumulative)
  File "D:\Python\Python35\lib\site-packages\seaborn\distributions.py", line 328, in _statsmodels_univariate_kde
    kde.fit(kernel, bw, fft, gridsize=gridsize, cut=cut, clip=clip)
  File "D:\Python\Python35\lib\site-packages\statsmodels\nonparametric\kde.py", line 146, in fit
    clip=clip, cut=cut)
  File "D:\Python\Python35\lib\site-packages\statsmodels\nonparametric\kde.py", line 506, in kdensityfft
    f = revrt(zstar)
  File "D:\Python\Python35\lib\site-packages\statsmodels\nonparametric\kdetools.py", line 20, in revrt
    y = X[:m/2+1] + np.r_[0,X[m/2+1:],0]*1j
TypeError: slice indices must be integers or None or have an __index__ method

My platform is win10 and seaborn version is (0.7.1) and statsmodels version is (0.6.1).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@PyAntony update your statsmodels package to 0.8.0 pip install -U statsmodels should do the trick

I had this issue but upgrading to statsmodels 0.8.0 worked for me. I used:

conda install -c statsmodels statsmodels=0.8.0