Skip to content

Instantly share code, notes, and snippets.

@Alakhator
Created March 2, 2020 13:12
Show Gist options
  • Save Alakhator/b91d8fdfdc52170d0006f0c57bda350f to your computer and use it in GitHub Desktop.
Save Alakhator/b91d8fdfdc52170d0006f0c57bda350f to your computer and use it in GitHub Desktop.
df["User_Mean"] = df.groupby('User_ID')["Purchase"].transform('mean')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment