question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

one kdeplot function error of seaborn

See original GitHub issue

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).

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
rauchercommented, Apr 26, 2017

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

1reaction
JoshuaC3commented, Jun 22, 2017

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

conda install -c statsmodels statsmodels=0.8.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

seaborn.kdeplot — seaborn 0.12.1 documentation - PyData |
A kernel density estimate (KDE) plot is a method for visualizing the distribution of observations in a dataset, analogous to a histogram.
Read more >
Using seaborn kdeplot returns errors - python - Stack Overflow
I'm trying to make a kde plot for some data, which looks like this: age sex 0 39 Male 1 50 Male 2...
Read more >
Seaborn Kdeplot - A Comprehensive Guide - DigitalOcean
kdeplot () function is used to plot the data against a single/univariate variable. It represents the probability distribution of the data values ...
Read more >
How to use the seaborn.kdeplot function in seaborn - Snyk
To help you get started, we've selected a few seaborn examples, based on popular ways it is used in public projects. ; if...
Read more >
Seaborn Kdeplot – A Comprehensive Guide - GeeksforGeeks
Kernel Density Estimate (KDE) Plot and Kdeplot allows us to estimate the probability density function of the continuous or non-parametric ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found