什么是Python相当于R的match()函数?

时间:2015-02-24 01:10:50

标签: python r indexing match matching

R有一个match()函数,例如:

a=c(1,2,3,4,5)
b=c(1,2,6)
match(b,a,nomatch=-1) #find index of b values in a

R中的索引值是从1开始的,因此上面的match()调用将输出:

1  2 -1

在Python中实现它的等效函数或最佳方法是什么?提前谢谢。

0 个答案:

没有答案
相关问题