3
令人惊讶的是,我无法在pandas DataFrame中找到SQL的“NOT IN”运算符的模拟。PANDAS模拟SQL的“NOT IN”运算符
A = pd.DataFrame({'a':[6,8,3,9,5],
'b':['II','I','I','III','II']})
B = pd.DataFrame({'c':[1,2,3,4,5]})
我想从A
所有行,这a
不含有B
的c
值。 喜欢的东西:
A = A[ A.a not in B.c]
这真是一个傻瓜:HTTPS:/ /stackoverflow.com/questions/12065885/how-to-filter-the-dataframe-rows-of-pandas-by-within-in你只是否定'isin'使用'〜'甚至这个:https:// stackoverflow.com/questions/32980087/pandas-not-in-in-and-between – EdChum
虽然这是概念上的,一个重复的,另一个问题不包含短语“不在”...允许这个问题保持开放将有助于其他人搜索该确切的短语。 –
@JDLong另一个问题确实在标题中没有在:https://stackoverflow.com/questions/32980087/pandas-not-in-in-and-between – EdChum