hvplot
hvplot copied to clipboard
Can't use select widget to update interactive table
Software (anaconda in windows 10/11): panel: 0.12.4 holoviews: 1.14.6 hvplot: 0.7.3 python: 3.9.7
I'm trying to use the select widget to choose which column appears in an interactive table. This works when returning a dataframe:
import panel as pn
from bokeh.sampledata.autompg import autompg
pn.extension()
s = pn.widgets.Select(options=list(autompg.columns))
def t(col1): return autompg[[col1,'cyl']]
pn.Column(s, pn.bind(t, col1=s))
But not for an interactive table:
import panel as pn, hvplot.pandas
from bokeh.sampledata.autompg import autompg
pn.extension()
s = pn.widgets.Select(options=list(autompg.columns))
autompg = autompg.interactive()
def t(col1): return autompg[[col1,'cyl']]
pn.Column(s, pn.bind(t, col1=s))
The reason I'm using the latter is because I also want to combine it linked selections as described here.
Not quite sure what's up with that but this works:
s = pn.widgets.Select(options=list(autompg.columns))
autompg = autompg.interactive()
def t(col1):
return pn.pane.Interactive(autompg[[col1,'cyl']])
Appears to be a bug in .interactive
itself. The process that is used to discover how to render the component seems to leave the Interactive object in a weird state where it renders as something other than what we want.
I can reproduce.