I have this data: https://www.kaggle.com/uciml/mushroom-classification. I have split the dataframe by target column values, and trying to plot dataframes plots side by side to analyze the difference. I have used two for loops for each dataframe. this is my code:
edible = df[df['class']=='e']
poisonous = df[df['class']=='p']
for i in edible:
fig = px.bar(x=df[i].value_counts().index, y=df[i].value_counts(), text=
(df[i].value_counts()/len(df[i])*100),title=str(i)+' Edible Mushroom Distribution')
fig.show()
for j in poisonous:
fig = px.bar(x=df[j].value_counts().index, y=df[j].value_counts(), text=(df[j].value_counts()/len(df[i])*100),title=str(i)+' Poisonous Mushroom Distribution')
fig.show()
Code is successful in creating all the plots but there are two problems:
- It takes two much time to show all plots
- I need the columns to be side by side for analysis, I don't know how can i achieve that.
Can someone please help me. Thanks