我有以下数据框。如何找到Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pandas
ImportError: No module named 'pandas'
a=1,3,7
答案 0 :(得分:3)
我们可以使用%in%
来获取逻辑索引
which(df$a %in% c(1,3,7))
或match
match(c(1,3,7), df$a)