Combine plots and tables with linked selection and data source selection by widget

Thanks for the report, which I can reproduce.

For the second case, it looks to me like a bug in Panel or hvPlot, because updating the panel based on the widget works fine for a plain Pandas 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 fails to update the table when it’s an hvPlot .interactive object:

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))

It does look like the callback is being executed in both cases (if I put e.g. if col1!='mpg': 1/0 in the callback and watch the JS console), but the web page doesn’t get updated to the new table. I don’t see any other messages on the JS console. Seems like a bug to report on Panel, to me!

For the first case, if I watch the JS console, there are various messages printed that suggest that the linked selections filtering is getting confused by applying a filter to data that has different columns defined than it expects. I can’t immediately tell if that’s a bug (i.e., whether link_selections should silently proceed if some columns are missing) or if it’s a misuse of link_selections and there’s a different way to make it work.

1 Like