Jupyter Notebook Widgets: Create dependent dropdowns Jupyter Notebook Widgets: Create dependent dropdowns pandas pandas

Jupyter Notebook Widgets: Create dependent dropdowns


I found out how to do this. I hope this helps for anyone else who's also looking to do the same thing.

x_widget = Dropdown(options = ['a','b','c'])y_widget = Dropdown()# Define a function that updates the content of y based on what we select for xdef update(*args):    y_widget.options = df[x_widget.value].unique().tolist()x_widget.observe(update)# Some function you want executeddef random_function():...interact(random_function,         x = x_widget,         y = y_widget);