Skip to content

Instantly share code, notes, and snippets.

@Dhrumilcse
Last active May 20, 2021 23:21
Show Gist options
  • Save Dhrumilcse/1b90deab1c94db543b135a41946ce942 to your computer and use it in GitHub Desktop.
Save Dhrumilcse/1b90deab1c94db543b135a41946ce942 to your computer and use it in GitHub Desktop.
def filter_data(data):
# Creating Dropdowns and buttons
dropdown_currency = widgets.Dropdown(options=data.currency.unique(), description='Currency:')
# Event handler for dropdowns
def dropdown_currency_eventhandler(change):
common_filtering(data, change.new)
#Call
dropdown_currency.observe(dropdown_currency_eventhandler, names='value')
#Layout box
input_widgets = widgets.HBox([dropdown_currency])
with filter_toggle_output:
display(input_widgets)
def common_filtering(data, currency):
common_filter = data[(data.currency == currency)]
with data_output:
display(common_filter)
return common_filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment