Reputation: 1183
I have a panda dataframe called language
consisting of two columns:
lang level
0 english 2
1 spanish 2
2 spanish 1
3 english 1
4 english 3
5 spanish 2
6 spanish 1
7 spanish 3
I would like to represent it in a histogram group by the categorical value language in such a way that in the same plot I have 2 groups -one for each language- with as many bar as many labels I have in the level column (3 in this case).
So far I have tried the following by previously categorizaing lang
getting a label of 1
to english
and of 2
to spanish
:
language.hist(by=language['lang'])
With what I obtained the following graph which is not what I want.
Ideally I would like a graph similar to this where the LetterGrade
would be language
and the legend would refer to the level
variable.
Upvotes: 0
Views: 895