【问题标题】:Seaborn pariplot when one category subset is missing data一个类别子集缺少数据时的 Seaborn 配对图
【发布时间】:2019-11-01 21:53:21
【问题描述】:

当一个类别由 NAN 组成(但其他列包含良好数据)时,pairplot 失败:

例如,在 iris 数据集中,如果某个物种的所有测量值都缺少“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

Seaborn pairplot error when dataset has NaN values

【问题讨论】:

    标签: python plot seaborn nan


    【解决方案1】:

    您链接的修复程序已合并到 GitHub 上的 master 和 0.9 分支,但不是 seaborn 0.9.0 已发布版本的一部分。它可能会在 seaborn 0.9.1 中出现,但尚未发布。

    现在要访问此功能,您可以安装 seaborn 的 GitHub 主分支版本,例如使用点子:

    pip install git+https://github.com/mwaskom/seaborn.git
    

    【讨论】:

      猜你喜欢
      • 2019-12-12
      • 2022-01-12
      • 2022-01-22
      • 2015-05-15
      • 2016-05-27
      • 2019-06-22
      • 2021-11-19
      • 2016-04-29
      • 1970-01-01
      相关资源
      最近更新 更多