我使用Dash by Plotly和python来创建一个web应用程序。 我一直在努力让多个值在一个下拉元素上正确显示。从pandas数据帧开始,我提取列1,然后在另一列2中选择与列1中的值相对应的值。下拉列表中将显示多个值。附件是应用程序正在做什么的GIF。我希望dropdown 2中的值是单独行上的独立值,即不同的值,而不是连接在一起。在
我认为问题在于如何返回
def update_dropdown2(wdg):
wdgarray=df[ df['wdg'] == wdg ]['id'],
return [{'label':i,'value':i} for i in wdgarray]
这是一个gif文件,显示了 second dropdown element display on each line
代码如下:
^{pr2}$
pdh在这个令人惊叹的plotly社区中提出的解决方案是删除逗号,它将本应是熊猫系列的内容转换为元组。 Link to solution from Plotly community
相关问题 更多 >
编程相关推荐