小编SiO*_*iOx的帖子

在numpy数组中查找包含子字符串的条目?

我试图在包含带有np.where和条件的子字符串的数组中查找条目:

import numpy as np
foo = "aa"
bar = np.array(["aaa", "aab", "aca"])
np.where(foo in bar)
Run Code Online (Sandbox Code Playgroud)

这只返回一个空数组.
为什么会这样?
还有一个很好的替代解决方案吗?

numpy where string-comparison python-3.4

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

numpy ×1

python-3.4 ×1

string-comparison ×1

where ×1