Linking Tabulator with HV Plot using different dataframe

Hi everyone,

I’m trying to link tabulator to an hvPlot that references a different DataFrame. I’ve already check the previous quiestions but they reference the same DataFrame. Here is my situation:

I have a main DataFrame df as below:

df = pd.DataFrame(data={"product": ["x", "y", "z","x","x"],
                        "date": ["2022-01-01", "2022-01-02", "2022-01-03","2022-01-04","2022-01-05"],
                        "count": [1,3,4,5,6]})

I run some analysis and get a second DataFrame df2 as below:

df2 = pd.DataFrame(data={"product": ["x","y"],
                        "category": ["a","b"]})

I need to show df2 in a tabulator widget. When a row is clicked/selected, I want to show the plot of selected product&category by filtering the main df and generating the plot. When using pn.bind, param.selection gets only the index of the selected row of the df2 which I can’t use for filtering on the df. How can solve this puzzle?