问题
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