【发布时间】:2021-04-12 18:37:16
【问题描述】:
例如,
a = [1, 1, 2, 4, 4, 4, 5, 6, 7, 100]
b = [1, 2, 2, 2, 2, 4, 5, 7, 8, 100]
我可以使用以下方法找到匹配的元素:
np.intersect1d(a,b)
输出:
array([ 1, 2, 4, 5, 7, 100])
那么,如何分别获取数组a和b中匹配元素的索引呢?
IDL 中有一个函数为"match" - https://www.l3harrisgeospatial.com/docs/match.html
Python中有类似的函数吗?
【问题讨论】:
标签: python match intersection indices idl