This is the input dataframe that I'm having.
And this is the output that I want:
As you can see, both the dataframes are merged on the column Key1 in such a way that the row with common elements are separated by commas.
I have tried using merge but it doesn't give the correct output.
mer = pd.merge(df,df, on='Key1', how='inner')
Is there a specific way to approach this?

