Reputation: 43
I want to merge rows based on a common value i.e date of purchase.
How do i do this ?
Upvotes: 0
Views: 47
Reputation: 3663
You can try this:
df = df.groupby(['DateOfPurchase'])['Item'].apply(','.join).reset_index()
print(df)
Output:
DateOfPurchase Item
0 19-Aug-2020 Apple,Eggs
1 20-Aug-2020 Banana
Upvotes: 1