I want to create multiple tabs that each contains one pandas DataFrame:
For reproduction this code here can be used:
import streamlit as st
import pandas as pd
import numpy as np
def df_in_tab(tab):
with tab:
df = pd.DataFrame(np.random.randn(5, 3), columns=list('ABC')) # create random dataframe
st.write(df)
st.write("Test")
classes = [str(x) for x in range(1,13)]
tabs = [tab1, tab2, tab3,tab4,tab5,tab6,tab7,tab8,tab9,tab10, tab11, tab12] = st.tabs(classes)
for tab in tabs:
df_in_tab(tab)
When i click on a different tab (e.g 10) the dataframe is not fully loaded:
This also happens if i wait 30 seconds before clicking tab 10. So it’s not a timing issue.
But if I then click on tab 11 (also not loaded) and then back to 10 it seems to refresh and then I get the full dataframe
How can I load all dataframes instantly in the tabs so I don’t get this broken visualization?
Edit: It seems that Firefox Browser might be the cause of this. In Chrome I don’t get the broken visualization