Add density curve on the histogram
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Question
00:36 Accepted answer (Score 3)
01:57 Answer 2 (Score 3)
02:24 Thank you
--
Full question
https://stackoverflow.com/questions/6446...
Accepted answer links:
[distplot]: https://seaborn.pydata.org/generated/sea...
[image]: https://i.stack.imgur.com/r4fJP.png
[removed in a future version of seaborn]: https://seaborn.pydata.org/generated/sea...
[histplot]: https://seaborn.pydata.org/generated/sea...
[displot]: https://seaborn.pydata.org/generated/sea...
[image]: https://i.stack.imgur.com/yOZrL.png
[image]: https://i.stack.imgur.com/Pnkce.png
Answer 2 links:
[image]: https://i.stack.imgur.com/VikWQ.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pandas #numpy #matplotlib #seaborn
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Question
00:36 Accepted answer (Score 3)
01:57 Answer 2 (Score 3)
02:24 Thank you
--
Full question
https://stackoverflow.com/questions/6446...
Accepted answer links:
[distplot]: https://seaborn.pydata.org/generated/sea...
[image]: https://i.stack.imgur.com/r4fJP.png
[removed in a future version of seaborn]: https://seaborn.pydata.org/generated/sea...
[histplot]: https://seaborn.pydata.org/generated/sea...
[displot]: https://seaborn.pydata.org/generated/sea...
[image]: https://i.stack.imgur.com/yOZrL.png
[image]: https://i.stack.imgur.com/Pnkce.png
Answer 2 links:
[image]: https://i.stack.imgur.com/VikWQ.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #pandas #numpy #matplotlib #seaborn
#avk47
ACCEPTED ANSWER
Score 5
distplot has been removed: removed in a future version of seaborn. Therefore, alternatives are to use histplot and displot.
sns.histplot
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
X = df['A']
sns.histplot(X, kde=True, bins=20)
plt.show()
sns.displot
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
X = df['A']
sns.displot(X, kde=True, bins=20)
plt.show()
distplot has been removed
Here is an approach using distplot method of seaborn. Also, mentioned in the comments:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD'))
X = df['A']
sns.distplot(X, kde=True, bins=20, hist=True)
plt.show()



