Experimental_data_editor category interdependency

I am wondering if it is possible for having interdependency for the columns in experimental_data_editor.

For the below toy example, I want to make the food displayed according to what category the user edits to in the category column. For example, if the user edits the dataframe and makes the category as dog, then the food column only shows one of [“Bones”, “Dog Food”,…] (this would be a select box) for things related to dog.

df = pd.DataFrame(
    {"Category": ["Cat", "Dog"], "Food": ["Fish", "Bones"], "Weight": [38, 27]}
)
df["Category"] = (
    df["Category"].astype("category").cat.add_categories(["Golden Fish", "Zebra"])

)

And user would be allowed to make changes / add new rows.

If this is not the best approach to go, please advice how could I achieve this, as I tried using forms however it is not working due to interdependency,

Thanks for help.

1 Like

Hey @Jenny! We don’t support that today and also don’t have plans for it at the moment. I’m seeing a few requests from people around interdependent columns. But I assume it will be very tricky to implement, so definitely not a thing we’ll do in the near future.

But I’ll keep an eye out and see if we get more requests! Feel free to also open a feature request on GitHub so it’s on our radar: Issues · streamlit/streamlit · GitHub

1 Like