I have a dataframe in which the column Segment Name contains 4 possible values: Lowest, Low, Middle and Higher. When I represent my bar plot in a dashboard, it only shows Lowest and Low in the x-axis.
The code that I use is the following one:
#Load dataframes
df = pd.read_sql('SELECT * FROM Companies_Public', con=db_connection)
print (df[df['SegmentName']=='4 - Higher']) # It returns correctly the values
#Configure data and layout
data = []
for IndustryName in df['IndustryName'].unique():
trace = go.Bar(
x=df['SegmentName'],
y=df[df['IndustryName']==IndustryName]['FinalPointsPerDemography'],
name = IndustryName)
data.append(trace)
layout = go.Layout(
title = 'Bar Plot',
barmode='stack')
#Configure figure
app.layout = html.Div([
dcc.Graph(
id='barplot',
figure=go.Figure(data=data, layout=layout)
)
])
if __name__ == '__main__':
app.run_server()
Does anyone know which could be the reason? Thanks in advance