Advertisement

去除离群值

阅读量:

离群点的选择需要斟酌一下,这里选择的方法是extreme outlier。

  • Subtract three times the interquartile range from the first quartile to determine the lower boundary.
  • Add three times the interquartil.range to the first quartil.e to identify th.e upper boundary.

原始数据是这样的:

在这里插入图片描述

剔除离群点:

复制代码
    first_quartile = data['A'].describe()['25%']
    third_quartile = data['A'].describe()['75%']
    iqr = third_quartile - first_quartile
    
    data = data[(data['A'] > (first_quartile - 3 * iqr)) &
           (data

全部评论 (0)

还没有任何评论哟~