jakevdp / PythonDataScienceHandbook

Python Data Science Handbook: full text in Jupyter Notebooks
http://jakevdp.github.io/PythonDataScienceHandbook
MIT License
43.12k stars 17.91k forks source link

04.14 Seaborn - Error "If using all scalar values, you must pass an index" in kdeplot #336

Open ivlmag opened 2 years ago

ivlmag commented 2 years ago

This line at 04.14-Visualization-With-Seaborn :

If we pass the full two-dimensional dataset to kdeplot, we will get a two-dimensional visualization of the data: sns.kdeplot(data)

Gives an error:

If using all scalar values, you must pass an index

To fix the error, more parameters should be added:

sns.kdeplot(data=data, x='x', y='y')

or

sns.kdeplot(data.x, data.y)