Different Select option for each cell of a column in Dataframe widget

I am trying to use Dataframe widget to create a table where I have different attributes in each row. Each of these attributes (Mass, Length, Time) has different set of units. Please see the attached code. I want to have specific set of options for each such attribute (eg. kg and g for mass, km and m for length ). Using SelectEditor, I am using the entire set of all the units involved.

What I am looking for is, when I am in the ‘Mass’ row, I should only get ‘kg’ and ‘g’ as the allowed options. Is it possible that I can specifically give options for unit of each attribute and not the entire list of units?


import pandas as pd
import panel as pn
from bokeh.models.widgets.tables import SelectEditor

pn.extension()

df = pd.DataFrame({'Attribute': ['Mass', 'Length', 'Time'], 'Unit': ['kg', 'm', 's'], 'bool': [True, False, True]}, index=[1, 2, 3])

editor = SelectEditor(options=['kg', 'g', 'km', 'm', 'min', 's'])

table = pn.widgets.DataFrame(df, editors={'Unit': editor})
table

@utkarshs1994 did you ever solve this issue? I am having the same problem right now.