I currently have a dataframe full of IDs, and a different dataframe with IDs and other values, such as:
df1: ID df2: ID X1
1 1 12
3 2 23
4 3 22
6 4 11
7 5 66
8 6 17
I am looking to remove rows in df2, if their ID does not appear in df1. There are fewer rows in df1, I'm not sure if this impacts the code at all!
Any help would be greatly appreciated! Thank you.