如何从列表中检测出局限器

发布于 2025-02-13 07:47:22 字数 405 浏览 0 评论 0原文

我有一个带有值的列表。从此列表中,我想获得Outliners。

list_of_values = [2, 3, 100, 5, 53, 5, 4, 7]

def detect_outlier(data):
  
    threshold= 3
    mean_1 = np.mean(data)
    std_1 =np.std(data)
     
    outliers = [y for y in data if (np.abs((y - mean_1)/std_1) > threshold)]
            
    return outliers

print(detect_outlier(list_of_values))

但是,我的印刷品空无一人,又名A []没有任何内容。有什么想法吗?

I have a list with values. From this list I would like to get the outliners.

list_of_values = [2, 3, 100, 5, 53, 5, 4, 7]

def detect_outlier(data):
  
    threshold= 3
    mean_1 = np.mean(data)
    std_1 =np.std(data)
     
    outliers = [y for y in data if (np.abs((y - mean_1)/std_1) > threshold)]
            
    return outliers

print(detect_outlier(list_of_values))

However, my print turns up empty, aka a [] without anything in it. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掀纱窥君容 2025-02-20 07:47:22

由于std_1 = 33.413,因此list_of_values中除以std_1的任何元素都将小于阈值,因此未产生。

Since std_1 = 33.413, any element in list_of_values divided by std_1 will be smaller than the threshold and hence not yielded.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文