Cached function running too frequently with stringio objects
See original GitHub issueHere is a bug noticed by a user on the forum. The code snippet below is reproducible. To see more here is the forum topic.
Quote by santosh_boina:
"But, when i use checkbox/selectbox/radio features to filter data to be shown as plots on tool, it reruns entire app.py script and starting from loading data again. Have I overlooked or missed something to include in my code to avoid this kind of problems.
My code is given here:
df_uploaded = st.sidebar.file_uploader(‘Choose txt file:’,type = [‘txt’,‘csv’]) @st.cache(hash_funcs={StringIO: StringIO.getvalue}) def load_data(file_uploaded): return (pd.read_table(file_uploaded,header=None,encoding=‘utf-8’)) if df_uploaded: temp = load_data(df_uploaded) select_cols = st.selectbox('Choose column for analysis', list(temp.columns)) if select_cols: ** code to plot the variable distribution/scatter plot
"
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hey @will-holley,
This was first natively supported in 0.57.0. Here is the pull request if interested in taking a look.
Thanks, @tc87.