Black Lives Matter. Please consider donating to Black Girls Code today.

How to create stacked bar plot for grouped values within a single column

Hi,

I know how to create a stacked bar chart based on multiple series or columns, but how would you do this for a single column of data that have been using the groupby method with their size (value) count?
The code below creates individual bar charts of each grouped set of data along the x-axis with the total value of each group as the y-axis. But now I want to stacked all the bar charts together, so that I will only see one single bar chart. Not sure if this is directly possible, maybe I need to transpose the data using Pandas first.

df = pd.read_excel(‘testfile.xlsx’, sheet_name=‘Sheet1’)
dfstate = df.groupby(‘State’)
dff = pd.DataFrame(dfstate.size().reset_index(name = “status”))

cc.Graph(id=‘plot1’,
figure={
‘data’: [go.Bar(x=dff[‘State’],
y=dff[‘status’], width = [0.5, 0.5, 0.5, 0.5, 0.5], marker={‘color’: [’#ff7f0e’,
#db4052’, ‘#ffc125’, ‘#32ab60’, ‘#3780bf’]})],
‘layout’: go.Layout(title=‘Review States’,
yaxis={‘title’: ‘Completion Status’})}),

Regards,
Gus