I am trying to graph horizontal bar chart. There are id values that should be on y axis and x axis should cointain count. My idea is to get text descriptions on y axis instead of id values. So I was thinking of making like a dictionary, specifying what id should translate to what text value
here is part of code:
def update_figure(bar):
filtered_df = df[df.academic_year == bar]
count = filtered_df['working_place_id'].value_counts()
name = filtered_df['working_place_id']
return {
'data': [
{'x': count,
'y': ['0': 'no data',
'2' : 'blah1',
'3' : 'something',
'4' : 'else',
]},
'type': 'bar',
'orientation': 'h'
}],
'layout':
go.Layout(title='horizontal graph')
But ofcourse I am defining y values wrong and it does not work. Am I trying to do the impossible? What is the right way to βmapβ values so to say?