a b c d
0 1 2 3 6
1 1 2 4 8
2 1 2 4 6
3 1 2 3 8
I would like to group this DataFrame
by the column a, b, d
, add a column to the original df
to mark which group it belongs to, the output should be
a b c d g
0 1 2 3 6 0
1 1 2 4 8 1
2 1 2 4 6 0
3 1 2 3 8 1