-1

I have this attribute error when I run the program. may I know the reason?

AttributeError: partially initialized module 'seaborn' has no attribute 'distplot' (most likely due to a circular import)

this is the code I wrote

from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns

sns.displot(random.normal(size=1000), hist=False)

plt.show()
Countour-Integral
  • 1,138
  • 2
  • 7
  • 21
  • What's the full stack trace? – Countour-Integral Jan 10 '21 at 12:33
  • The [docs](https://seaborn.pydata.org/generated/seaborn.distplot.html) show that it is deprecated. It depends what version you're using – roganjosh Jan 10 '21 at 12:34
  • 1
    In your question you write `distplot`, but in the code you write `displot` (without the `t`). They are related but different functions. `displot` is new since Seaborn 0.11, which also deprecated `distplot`. Possibly you are running an older version of Seaborn. – JohanC Jan 10 '21 at 13:20

1 Answers1

-1

You can try this:

from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns

sns.distplot(random.normal(size=1000), hist=False)

plt.show()

Code modified by me:

sns.displot(x) -> sns.distplot(o)

This is output:

enter image description here

Robot Jung
  • 367
  • 4
  • 13