Reputation: 183
I have a function that takes in a variable from a slider widget in a jupyter notebook, does some computation, and returns a dataframe. How can I make it so this dataframe does not display every time the slider value is updated?
If I do something like:
r = interact(process_data, data=fixed(df), values=(1,5,1))
where "process_data" is my function. The result of "r" is always displayed right now. How can I stop this from happening? I want to save the dataframe "r" to use later.
Upvotes: 1
Views: 586
Reputation: 85442
Set __manual
to True
:
r = interact(process_data, data=fixed(df), values=(1,5,1), __manual=True)
This gives you a button to click for executing your function.
Or, set continuous_update=False
:
r = interact(process_data, data=fixed(df), values=(1,5,1),continuous_update=False))
to get the update only when you release the mouse button.
Upvotes: 2