If my dataframe is like this,
X Y Z
1 a
1 b
2 c
the output should be
X Y Z
1 a a,b
1 b a,b
2 c
Condition:
If a X has duplicates then it should all take the values of Y of that X duplicate and convert to csv values and paste in column Z