I want to keep all rows where the value in one of the columns is in a list. (or if you want delete the rows where the value in a columns is not in the list.
In the df['ID'] column there is a large number of ID's and they occur several times. There are only some of them that i want to keep. Those ID's are kept as strings in a list called surv3.
I tried this:
df = df.loc[(df['ID'] in surv3)]