【发布时间】:2022-01-17 02:25:36
【问题描述】:
我在使用 plotly graph_objs 时遇到问题。
我正在尝试在指定值的同时使数据可视化:
@app.callback(
Output('nps-indicator', 'figure'),
Input('dropdown-id', 'value')
)
def indicator_func(selected_month):
filtered_df = df[df['Mês pesquisa'].isin(selected_month)]
a = filtered_df['NPS']
figScore = go.Figure(go.Indicator(
`mode="gauge+number+delta",
value=[int(nps_calculate(a))],
title={'text': "NPS Score"},
domain={'x': [0, 1], 'y': [0, 1]},
))
figScore.update_layout(plot_bgcolor='#001122', paper_bgcolor='#001122')
return figScore
'value' 属性是一个数字,可以指定为: - 整数或浮点数
我收到此错误,但我不知道为什么.. 有人可以帮我找出问题所在吗?
【问题讨论】:
-
您能提供更多信息吗?你想要的输出是什么,你的 DataFrame 是什么样的?你的代码现在不是reproducible
-
对不起,这是我的第一篇文章,我不太擅长...基本上我正在使用 plotly 和 Dash 模块在 PYTHON 中进行 DASH。我需要选择月份值并返回该值的 AVERAGE。我使用 excel 存档作为数据框,我根据所选值计算它。
标签: python plotly plotly-dash