Python 根据df1中另一列中的字符串删除df2中的行

Python 根据df1中另一列中的字符串删除df2中的行,python,python-3.x,pandas,Python,Python 3.x,Pandas,我有两个熊猫数据帧,其中id,第一次看到的,最后一次看到的是字符串,days.\u fire是一个int。我想从df2中删除id,其中df1中的最后一次看到的等于'2020-05-02' df1 id first_seen last_seen days_since_fire 0 001 2020-05-01 2020-05-01 0 1 002 2020-05-01 2020-05-01 0 2 003 2020-05-02 2020-05-02 0 d

我有两个熊猫数据帧,其中
id
第一次看到的
最后一次看到的
是字符串,
days.\u fire
是一个int。我想从df2中删除
id
,其中df1中的
最后一次看到的
等于'2020-05-02'

df1
    id  first_seen  last_seen   days_since_fire
0   001 2020-05-01  2020-05-01  0
1   002 2020-05-01  2020-05-01  0
2   003 2020-05-02  2020-05-02  0

df2
    id
0   001
1   003
2   002
3   004
预期结果:

df2
    id
0   001
2   002
3   004
就你而言

df2=df2.loc[~df2.id.isin(df1.loc[df1.last_seen=='2020-05-02','id'])].copy()
df2
Out[393]: 
   id
0   1
2   2
3   4

带有isinalready的chekc看不到带有2个数据帧的示例@YOBEN\u或将
==
更改为
=
保存
~
:)