Created
October 31, 2022 14:37
-
-
Save AnupJoseph/c429213852419dd09be6a9c932f28989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gadfly.with_theme(:dark) do | |
# Subset the data with only rows I need | |
gender,age = names(dataset)[3],names(dataset)[2] | |
age_with_gender_data = dataset[!,2:3] | |
# grouby age and gender and then count | |
age_and_gender_counts = combine( | |
groupby( | |
age_with_gender_data,[gender,age]) | |
, nrow => :n | |
) | |
# Sort the results by age | |
sort!(age_and_gender_counts,age) | |
age_gender_plot = plot( | |
age_and_gender_counts, | |
x=age, | |
y=:n, | |
color=gender, | |
style(bar_spacing=2mm), | |
Guide.ylabel("Frequency"), | |
Geom.bar | |
) | |
# draw(SVG("kaggle_age_gender_plot.svg"),age_gender_plot) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment