Summary statistics display in the front end dashboard

好久不见. 提交于 2020-03-05 04:06:10

问题


I wanted to inquire, i am using dash, how to display a value computed from the back end? say I am going to show the sum (in the front end) of the Sales column from a dataframe df in the backend, so, how should i set up the dashboard?

i understand i will have the line below for the output,

html.Div(id='sum')

but how do i set the callback?

@app.callback(Output('sum', 'children'), 
                     [Input('df', 'value')])
     def get_sum('Sales'):
         sum = df["Sales"].sum
         return 'Grand Total = "{}"'.format(sum)

thank you guys! by the way, i read this too, How to get the count from a dataframe from a Dash Callback but the input was a drop down, mine is no value input needed, i only need to show the value of the statistics summary each time i open the dashboard.

my desired result is as follow,

The dollar sign is my html.Img; the Total Annual Revenue is my html.H1; while the 45.7M is the location I want my statistics in.

来源:https://stackoverflow.com/questions/60069502/summary-statistics-display-in-the-front-end-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!