I have two dataframes:
df1
Person Date Company Name Symbol ID
0 Dale 2019 Q4 A Corp AAA 10
1 Bill 2019 Q4 B Corp NaN 20
2 Hank 2019 Q4 C Corp NaN 30
3 Rusty 2019 Q4 C Corp CCC 30
4 Peggy 2019 Q4 X Corp NaN 100
5 John 2019 Q4 Y Corp NaN 200
6 Kahn 2019 Q4 Z Corp NaN 300
7 Mihn 2019 Q4 Z Corp NaN 300
df2
Company Name Symbol ID
0 A Corp AAA 10
1 B Corp BBB 20
2 C Corp CCC 30
3 D Corp DDD 40
4 E Corp EEE 50
5 F Corp FFF 60
6 G Corp GGG 70
7 H Corp HHH 80
8 I Corp III 90
And I want to create a new df3
which is made up of IDs
that are in df1
, but not in df2
,so that the output would look like:
df3
Company Name Symbol ID
1 X Corp 100
2 Y Corp 200
3 Z Corp 300
How would I achieve this?