Hi everybody!
I’m trying to make a countplot with StatsPlots, and i’m using the code below, that works, but i want to know if have a simplest or clever way to achieve this.
begin
@df df Plots.bar(unique(df.Gender),
[count(i->i==("Female"), df.Gender),count(i->i==("Male"), df.Gender)])
end
The problem of my code is if have a lot of different categories like the column “Geography” i need to specify manually each category value.
Here’s a sample of my dataframe:
RowNumber | CustomerId | Surname | CreditScore | Geography | Gender | Age | Tenure | Balance | NumOfProducts | HasCrCard | IsActiveMember | EstimatedSalary | Exited | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Int64 | Int64 | String31 | Int64 | String7 | String7 | Int64 | Int64 | Float64 | Int64 | Int64 | Int64 | Float64 | Int64 | |
1 | 1 | 15634602 | Hargrave | 619 | France | Female | 42 | 2 | 0.0 | 1 | 1 | 1 | 1,01E+10 | 1 |
2 | 2 | 15647311 | Hill | 608 | Spain | Female | 41 | 1 | 83807.9 | 1 | 0 | 1 | 1,13E+10 | 0 |
3 | 3 | 15619304 | Onio | 502 | France | Female | 42 | 8 | 1,60E+10 | 3 | 1 | 0 | 1,14E+10 | 1 |
4 | 4 | 15701354 | Boni | 699 | France | Female | 39 | 1 | 0.0 | 2 | 0 | 0 | 93826.6 | 0 |
5 | 5 | 15737888 | Mitchell | 850 | Spain | Female | 43 | 2 | 1,26E+10 | 1 | 1 | 1 | 79084.1 | 0 |
Thx!