I have a dataframe like:
index year month age
0 2020 January 20
1 2021 April 35
2 2020 February 30
3 2022 March 35
4 2019 April 47
5 2022 February 18
6 2020 January 43
7 2021 April 28
8 2019 April 37
9 2022 February 24
I'm making a chart like this:
plt.figure(figsize=(10, 8))
sns.countplot(x='year', data=df, hue='age')
plt.show()
But as a hue, I need to use not age, but 3 age groups: 20-30, 30-40 and over 40 years old. How to divide the age into 3 groups and use them as a hue? Thanks.