[IPython-dev] widget.interact
William Furnass
will at thearete.co.uk
Wed Jun 18 16:00:33 EDT 2014
Hi, is there a way of using widgets.interact so that it only creates
widgets for a subset of its arguments? This is handy for where you
already have a function for which you only want widgets for a few
params.
Below is an example of what I'd like to be able to do. At present
interact tries to create a widget from df then cries when it finds
it's an enormous pandas DataFrame.
Cheers,
Will
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
from IPython.html import widgets
from IPython.display import display
def f1(df, a, b, c):
# process pandas.DataFrame using parameters a, b and c
def init_graph(df, a, b, c):
f1(df, a, b, c):
fig = plt.figure()
# plot stuff here using the pandas.DataFrame df
init_graph(a, b, c, df)
i = widgets.interact(init_graph,
a=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
b=widgets.BoundedFloatTextWidget(min=0., max=10., value=0.1),
c=widgets.BoundedFloatTextWidget(min=0., max=10., value=1.))
More information about the IPython-dev
mailing list