I have a dataframe and I would like to extract data by some conditions.
My dataframe is like this:
 A  B   D
e1  r2  a
e8  r7  a
e2  r2  a..b
e5  e10 c
e8  e12 c..a
For each value in the column D (a, b, c) I would like to get values from A and B like this:
a : [[e1, r2], [e8, r7], [e2,r2], [e8, e12]]
b : [[e2, r2]]
c : [[e5, e10], [e8, e12]]
....
This is what I've tried but I don't know how to extract the columns A and B.
df
l = ['a','b','c']
list_elements = {}
for i in l:
    liste_e = []
        for e in df['d']:
        if i.upper() in e:
            liste_e.append([e1, r2])
        ## extract a : [[e1, r2], [e8, r7], [e2,r2], [e8, e12]]
        list_elements[i] = liste_e
 
     
    