【发布时间】:2021-02-23 08:45:17
【问题描述】:
我有一个如下所示的数据框:
num_column is_train
30.75 1
12.05 1
.. ..
43.79 0
15.35 0
我想使用小提琴图查看num_column 的分布,小提琴的每一侧(或分割)在is_train 列中显示我的两个类别中的每一个的数据。
来自examples in documentation,这是我能想到的:
import seaborn as sns
sns.violinplot(x=merged_data.loc[:,'num_column'], hue=merged_data.loc[:,'is_train'], split=True)
从这个结果,我可以看到参数hue 和split 根本没有效果。意思是小提琴的两边没有分开,我看不到任何传说,所以我假设hue 参数没有效果。
我正在尝试比较我的训练数据和测试数据中列的分布。
【问题讨论】:
标签: python pandas matplotlib seaborn violin-plot