I have a following dataframe.
CustID| Age |Gender|Smoking_history |Alcohol_history
1 |18-24| M | Non-smoker | <21 units per week
2 |43-48| F | Non-smoker | <21 units per week
3 |37-42| M | Unknown | <21 units per week
4 |18-24| F | Unknown | Unknown
5 |43-48| M | Previous smoker | <21 units per week
I created bar plot and used the following code:
df.groupby(['Smoking history','Age']).size().unstack().plot(kind='bar',stacked=True) plt.show()
It is noted that Age is a numeric range value, and "Smoking history" is string value.
It creates stacked bar plot in Jupyter Notebook and shows number of persons in different age groups based on smoking history.
I want to make it interactive, so that I can select columns from drop down list.
How can I do it by using ipywidgets in Jupyter Notebook?
** Is there any way to use non-numeric columns in plot?