I have a dataframe as like below:
df:
The expected output is like below:
I tried like below but doesn't work. I also tried with pivot not working.
df = df.groupby('id').['text'].apply(list)
df = df.reset_index()
pd.DataFrame(df.text.tolist(), index= df.index)
But the output is not expected. It has mixed the languages while grouping. When doing pivot also, I am getting the error "Index contains duplicate entries, cannot reshape". Can someone please help.