In general, tabs have a formulation like the following
tab1, tab2 = st.tabs(["title1", "title2"])
with tab1:
some_output()
with tab2:
some_output()
However, what I’d like to do is create a dynamic number of tabs with labels that are based on the unique values for a given dataframe column. Let’s suppose I have a dataframe that looks something like the following:
var | value |
---|---|
var1 | 234 |
var1 | 72 |
var2 | 9832 |
var2 | 972 |
var3 | 821 |
var3 | 082 |
What I’d like to do here is create a tab for each unique value of var, which in this case would be 3. So in the end it would behave as though I had coded
tab1, tab2, tab3 = st.tabs(["var1", "var2","var3"])
with tab1:
some_output()
with tab2:
some_output()
with tab3:
some_output()
In other situations, there may be more unique values for var, in which case it would be ncessary to have additjonal tabs.
I’m curious if anyone has solved a similar problem; or if there is some other way to go about this that I am missing.