Skip to main content
Question

Applying a filter on Streamlit is consuming time to give me results

  • October 30, 2024
  • 3 replies
  • 23 views

Hi Team, 

I am trying to develop a Streamlit app. When I am chaning the filter condition it is taking longer than expected time to apply those filters and fetch me the data I want. 

3 replies

APSHANKAR Sagar
Committed

Hello @Rajendra Pasupuleti , in my  experience, filters apply quickly but the various preprocessing steps before the filter can take time. Try to put everything that will always return the same value in functions and decorate the function with st.cache_data. 


When the data volume is in thousands it is working fine but when the data grows into more than 200K+ it’s taking very long. I do have st.cache_data on my code. 


Forum|alt.badge.img+3
  • Seasoned
  • 26 replies
  • October 30, 2024
APSHANKAR Sagar wrote:

Hello @Rajendra Pasupuleti , in my  experience, filters apply quickly but the various preprocessing steps before the filter can take time. Try to put everything that will always return the same value in functions and decorate the function with st.cache_data. 

Yes this method solves the issue with Data Retrieval and Filtering. In case if it doesn't it may be worthwhile to validate the Filtering logic( for example switching for Loop with a lambda function)


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings