I have a pandas dataframe which shows in each shopping mall, how much the males spend money and how much the females spend money. Its like this -
ShoppingMall MaleSpends FemaleSpends
0 XX 5600.20 4500.70
1 YY 9000.00 100000.00
2 zz 7809.45 5600.89
In one graph I have to plot the malespends and femalespends.
I can plot the graphs separately in plotly -
import plotly.express as px
fig1=px.bar(data,x='ShoppingMall',y='MaleSpends',barmode='group')
fig2=px.bar(data,x='ShoppingMall',y='FemaleSpends',barmode='group')
But I need to plot the money spent by males and females in one figure. A screenshot is shown .
At its simplest, using plotly's expres function to create the code, the graph can be created with the following one line.
px.bar(df, x='ShoppingMall', y=['MaleSpends', 'FemaleSpends'], barmode='group')