In my dataframe (df), for each line, I need drop rows which the value from both node1 and node2 columns are matching with another list (groups).
df = pd.DataFrame(dict(node1=["A","A","B","C","D"], node2=["B","D","E","F","G"]))
> df
node1 node2
0 A B
1 A D
2 B E
3 C F
4 D G
groups = ["A","B","C","F"]
> groups
['A', 'B', 'C', 'F']
In this example, df's row 0 and row 3 have both values matching with my groups list, so I need to drop these rows. My new dataframe would be:
df2 = pd.DataFrame(dict(node1=["A","B","D"], node2=["D","E","G"]))
> df2
node1 node2
0 A D
1 B E
2 D G