Skip to content

Instantly share code, notes, and snippets.

@kxzk
Created August 9, 2019 21:35
Show Gist options
  • Save kxzk/1f01d6ed9857154b068d06ad905adf48 to your computer and use it in GitHub Desktop.
Save kxzk/1f01d6ed9857154b068d06ad905adf48 to your computer and use it in GitHub Desktop.
df.groupby("customer_id")["products"].value_counts().unstack().fillna(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment