Skip to content

Instantly share code, notes, and snippets.

@makispl
Last active February 22, 2021 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makispl/9e12830bf1d6fc305f985f39ec572621 to your computer and use it in GitHub Desktop.
Save makispl/9e12830bf1d6fc305f985f39ec572621 to your computer and use it in GitHub Desktop.
# Fing the unique categories
df.category.value_counts()
# Subset the df by the category column
sngl_mlt = df[df['category'] == 'Single Malt Scotch'].copy()
blnd = df[df['category'] == 'Blended Scotch Whisky'].copy()
blnd_mlt = df[df['category'] == 'Blended Malt Scotch Whisky'].copy()
# Calculate the mean of numerical columns
df.groupby('category').agg(np.mean)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment