I’m having trouble conceptualizing this and I’m hoping someone could provide a more elegant solution to what I currently have.
I am trying to create an editable df table with selectboxes that continue to filter the next selectbox as I move through each column. I’ve seen this post but this doesn’t apply to st.data_editor’s column_config’s selectboxColumns. Here’s what I have so far:
df = st.data_editor(get_df(), key="data_editor", num_rows="dynamic",
column_config={
"corporation": st.column_config.SelectboxColumn(
options=mydict
),
"project": st.column_config.SelectboxColumn(
options=mydict["corporation"]
),
"customer": st.column_config.SelectboxColumn(
options=mydict["corporation"]["project"]
),
"client": st.column_config.SelectboxColumn(
options=mydict["corporation"]["project"]["customer"]
)
}
)
Because it’s being declared the same argument, I’m assuming that’s why it’s not being recognized. Additionally, I’m not sure of any way to separate them to allow that since I can’t assign variables to a key/value pair being declared.
Additionally, setting up the dictionary to allow n-dimensions of a unique set of strings to allow the above logic to work is also giving me errors. I understand that it’s flawed but I’m curious if there’s an easier implementation available? Here’s what I currently have:
mydict = defaultdict(set)
for path in paths:
mydict[path.split("corporation=")[1].split("/")[0]]
.add(mydict[path.split("project=")[1].split("/")[0]])
.add(mydict[path.split("customer=")[1].split("/")[0]])
.add(path.split("client=")[1].split("/")[0])
I’m getting an error that says :
TypeError: unhashable type: 'set'
Any help is appreciated!