Skip to content

Instantly share code, notes, and snippets.

@kperry2215
Created November 21, 2019 05:18
Show Gist options
  • Save kperry2215/a1541588129d41bf849e6fe4f6d04b8b to your computer and use it in GitHub Desktop.
Save kperry2215/a1541588129d41bf849e6fe4f6d04b8b to your computer and use it in GitHub Desktop.
#Subset the data into salary categories
df_less_than_50k = df[df['salary'] == ' <=50K']
df_greater_than_50k = df[df['salary'] == ' >50K']
#Plot the histogram for the distribution for data <=$50K
generate_distribution_histogram(df_less_than_50k, 'age',
title = 'Age Distribution: US Population',
x_axis_label = 'Age (years)',
y_axis_label = 'Frequency',
label_name = '<=$50K')
#Plot the histogram for the distribution for data >$50K
generate_distribution_histogram(df_greater_than_50k, 'age',
title = 'Age Distribution: US Population',
x_axis_label = 'Age (years)',
y_axis_label = 'Frequency',
label_name = '>$50K')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment