当一个类别子集缺少数据时的 Seaborn pairplot
Seaborn pariplot when one category subset is missing data
当一个类别由 NAN 组成(但其他列包含良好数据)时,pairplot 失败:
例如,在鸢尾花数据集中,如果某个物种的所有测量值都缺少 "petal_width" 的测量值,则 pairplot 失败。真可惜,因为 sepal_length 的测量值很好,等等!仅仅因为一种类型的数据缺失,并不意味着其他类型的数据没有用!
iris.loc[(iris.species=='setosa'), 'petal_width']=pd.np.nan
报错:
ZeroDivisionError: 0.0 cannot be raised to a negative power
有什么策略可以解决吗?
看这里,看这里,光照不多。 Github 表示已修复,但在 Seaborn 0.9 中仍然出现错误。
https://github.com/mwaskom/seaborn/issues/1699
您链接的修复已合并到 GitHub 上的 master 和 0.9 分支,但不是 seaborn 0.9.0 已发布版本的一部分。它可能会出现在尚未发布的 seaborn 0.9.1 中。
现在要访问此功能,您可以安装 seaborn 的 GitHub master 分支版本,例如使用 pip:
pip install git+https://github.com/mwaskom/seaborn.git
当一个类别由 NAN 组成(但其他列包含良好数据)时,pairplot 失败:
例如,在鸢尾花数据集中,如果某个物种的所有测量值都缺少 "petal_width" 的测量值,则 pairplot 失败。真可惜,因为 sepal_length 的测量值很好,等等!仅仅因为一种类型的数据缺失,并不意味着其他类型的数据没有用!
iris.loc[(iris.species=='setosa'), 'petal_width']=pd.np.nan
报错:
ZeroDivisionError: 0.0 cannot be raised to a negative power
有什么策略可以解决吗?
看这里,看这里,光照不多。 Github 表示已修复,但在 Seaborn 0.9 中仍然出现错误。
https://github.com/mwaskom/seaborn/issues/1699
您链接的修复已合并到 GitHub 上的 master 和 0.9 分支,但不是 seaborn 0.9.0 已发布版本的一部分。它可能会出现在尚未发布的 seaborn 0.9.1 中。
现在要访问此功能,您可以安装 seaborn 的 GitHub master 分支版本,例如使用 pip:
pip install git+https://github.com/mwaskom/seaborn.git