Skip to content

Instantly share code, notes, and snippets.

@h-okay
Last active December 20, 2021 14:28
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 h-okay/56869f499ebd89fb45e6a8be39e01c2f to your computer and use it in GitHub Desktop.
Save h-okay/56869f499ebd89fb45e6a8be39e01c2f to your computer and use it in GitHub Desktop.
EDA for Level Based
# Unique Sources and Frequencies
df.SOURCE.value_counts()
# Unique Prices and Frequencies
df.PRICE.value_counts()
# Unique Countries and Frequencies
df.COUNTRY.value_counts()
# Total Income Accumulated by Countries
df.groupby('COUNTRY').PRICE.sum()
# Average Income Accumulated by Countries
df.groupby('COUNTRY').PRICE.mean()
# Average Income Accumulated by Sources
df.groupby('SOURCE').PRICE.mean()
# Average Income Accumulated by Countries and Sources
df.groupby(['COUNTRY', 'SOURCE']).PRICE.mean()
# Average Income Accumulated by Countries, Sources, Sex and Age
df.groupby(['COUNTRY', 'SOURCE', 'SEX', 'AGE']).PRICE.mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment