蓝山帝景
pandas.Series实现了combine方法,您可以通过以下方式使用该方法来查找b也出现在a列表中的元素:import pandas as pda = pd.Series([["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"]])b = pd.Series(["a","d","e", "c", "b"])a.combine(b, lambda a,b: b in a)输出:0 True1 True2 False3 True4 Truedtype: object
交互式爱情
这应该适合你:import pandas as pda = pd.Series([["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"],["a","b","c", "d"]])b = pd.Series(["a","d","e", "c", "b"])[x in y for y,x in zip(a,b)]...输出为:[True, True, False, True, True]