【问题标题】:python) I want to extract only values above 0.9 from the correlation tablepython) 我只想从相关表中提取大于 0.9 的值
【发布时间】:2019-11-06 01:12:36
【问题描述】:

我的相关表由 1446 x 1447 组成。

其中,我只想看到大于 0.9 的数字。 (包括 0.9)

【问题讨论】:

  • 嗨,欢迎来到 StackOverflow。您的意思是您需要找到值大于 0.9(每个值的索引)的位置或将它们可视化吗?
  • 不需要可视化。但是,我想收集大于 0.9 的值并将它们保存到文件中。 (例如:csv文件)
  • 请发布一段代码,而不是图片。

标签: python filtering correlation


【解决方案1】:

您可以使用numpy.where with condition 来查找满足条件的索引或实际值。

import numpy as np
table = np.random.rand(1446, 1447)
# get all indexes of elem having value >= 0.9
filtered_idx = np.where(table >= 0.9)
# get all elem values >= 0.9
filtered_values = table[filtered_idx]
assert all(filtered_values >= 0.9)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-06
    • 1970-01-01
    • 1970-01-01
    • 2019-04-04
    • 2020-05-16
    相关资源
    最近更新 更多