我有一个名为myList = []
的列表。
我想将此列表的零索引中的那些与数据帧pd的[“ numbers”]臂进行比较。我想将与列表不同的内容分开。
例如:
myList=["20","30","40","31","41"]
pd["numbers"] = ["20","30","40","41","31",**"50"**]
答案 0 :(得分:1)
使用set
例如:
myList=["20","30","40","31","41"]
df = pd.DataFrame({"numbers": ["20","30","40","41","31","50"]})
print(set(df['numbers']) - set(myList))
# --> {'50'}