I have a following pandas df:
df = { "id" : [1, 1, 1, 2, 2, 5], "name" : ["apple", "potato","lemon", "apple","potato","apple"]}
df = pd.DataFrame(df)
I would like to turn name column into rows based on id. Desired output is:
new_df = {1 : ["apple", "apple", "apple" ], 2: ["potato", "potato", ""], 3: ["lemmon", "", ""]}
new_df = pd.DataFrame(new_df)
How can I do it please?