简体   繁体   English

Databricks 笔记本中的多选小部件

[英]Multiselect widget in Databricks notebook

I made multiselect widgets in the databricks notebook.我在 databricks 笔记本中制作了多选小部件。

dbutils.widgets.multiselect("Scenario", "Actual", [str(x) for x in scenario_type])

But I wanted to use the selected value to update the table I have.但我想使用选定的值来更新我拥有的表。

Once there is only one item selected, it works.一旦只选择了一项,它就可以工作。

display(ur.filter((ur.scenario == getArgument("Scenario")))

However, if I select multiple items, it didn't obviously.但是,如果我 select 多个项目,它并不明显。

Do you know how to make multi-selection work in my scenario?你知道如何在我的场景中进行多选吗?

Thanks.谢谢。

You can make the list from selected values and use isin method to filter the records.您可以从选定的值中创建列表并使用isin方法过滤记录。

myList = getArgument("Scenario").split(",")
display(ur.filter(ur.scenario.isin(myList)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM