I would like two merge these two dataframes:
df1
a b c
4 0 1 3
5 0 1 3
6 0 1 3
2 1 2 2
3 1 2 2
15 2 1 3
12 2 1 3
13 2 1 3
15 3 1 4
14 3 1 4
8 3 1 4
9 3 1 4
df2
b c e
1 3 2
1 3 0
1 3 1
df1 should be grouped by a and merged with df2 if they are equal within one group of a. after merging/joining it should look like that:
a b c e
4 0 1 3 2
5 0 1 3 0
6 0 1 3 1
2 1 2 2 nan
3 1 2 2 nan
15 2 1 3 2
12 2 1 3 0
13 2 1 3 1
15 3 1 4 nan
14 3 1 4 nan
8 3 1 4 nan
9 3 1 4 nan
Can anyone help me?