如何根据特定键的值从 .npy 文件中检索行

how can I retrieve the rows from .npy file based upon the specific key's value

我使用 f=np.load(path/to/file)

在 colab 上加载了 .npy 文件

The structure of data looks like this

当我试图查看其中的字典键时,它显示

The keys in the files

现在我想根据图像中显示的名为“feature_path”的键的值提取行。

使用函数检索键值=“feature_path”

**myDict = {}

对于 f 中的 d: c = d['feature_path'] myDict[c] = myDict.get(c,0)+1 打印(我的字典)
特征 = myDict.values() 频率 = myDict.keys() 打印(功能) 打印(频率)**

if i just extract the values against this specific key it gives me an error

因为我的第一本字典没有那个“键”所以我不得不跳过第一行

我通过编辑解决了

for d in f[1:]: