我有2组数据:如何I“去合并”熊猫数据帧以产生2个不同的组
df1
'Y'
A a
B b
C c
D d
E e
df2
'Y'
D d
E e
F f
我需要变换所述第一DF1以去除在DF2 我可以任何数据出现很容易做到这一点使用SQL,但这不是我的选择 逻辑是'select * from df1 where df1.Y not in (select Y from df2)'
我似乎无法得到使用合并的实施权。有任何想法吗? 期望的结果:
df3
'Y'
A a
B b
C c
与DF2不变
相关:http://stackoverflow.com/questions/28901683/pandas-get-rows-which-are-in-other-dataframe and dupe:http://stackoverflow.com/questions/32651860/python-pandas-how-to-find-rows-in-one-dataframe - 丁非氟另一 – EdChum