我使用以下代码为变量绘制两个kdeplots:
income_df = attrition_df[['Annual Income','Terminated']]
income_left = income_df.loc[income_df['Terminated'] == 1]
income_stayed = income_df.loc[income_df['Terminated'] == 0]
x = np.array(income_left['Annual Income'].values)
y = np.array(income_stayed['Annual Income'].values)
ax = sns.kdeplot(x,y, shade=True)
但我收到的错误是:
ValueError:观察数量必须大于变量数量。
答案 0 :(得分:3)
您似乎想要绘制两个不同数量的kde图。
ax = sns.kdeplot(x)
sns.kdeplot(y, ax=ax)