I have two data frames:

first one is this :

enter image description here

which has 3 columns (ID , Name, Salary)

and the seconed data frame is this:

enter image description here

which has 2 columns (ID , Name)

I want to groupby ID in the first data frame (def1) after that I want to check if this ID (isin) the other data frame (def2), if it's NOT then I want to remove it. noting that the last output I need it to be as data frame as well, which is this:

enter image description here

how can I do this?

0

There are 0 answers