same_list=df2['ID'].tolist() df1=df1[~df1['ID'].isin(same_list)]
方法二:将df2先和df1合并,在利用drop_duplicates()去重
例子:
df1=df1.append(df2).drop_duplicates(keep=False) #keep=false保留不相同的