Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df["unique_products"] = df.groupby("customer_id").agg({"products": "unique"})
- # Transform each element -> row - Pandas >= 0.25
- df["unique_products"].explode()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement