I want to make a kdeplot for my pandas dataframe. I used the code below:
mean = [0,0]
cov = [[1,0],[0,100]]
dataset2 = np.random.multivariate_normal(mean,cov,1000)
dframe = pd.DataFrame(dataset2,columns=['X','Y'])
sns.kdeplot(dframe)
And got this error message:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-20-852468cc1da8> in <module>()
7 dframe = pd.DataFrame(dataset2,columns=['X','Y'])
8
----> 9 sns.kdeplot(dframe)
9 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/internals/construction.py in extract_index(data)
385
386 if not indexes and not raw_lengths:
--> 387 raise ValueError("If using all scalar values, you must pass an index")
388
389 if have_series:
ValueError: If using all scalar values, you must pass an index
How should I amend my code?
Note: It works when I instead use:
sns.kdeplot(dframe.X,dframe.Y)
sns.kdeplot(dframe)is not valid syntax, as perseaborn.kdeplot. You have not properly specified the parameters in order.