I have a Pandas dataframe that I am showing in the form of a st.data_ediitor component.
I am looking for the following functionality
Change some values in the table (which I am able to do so), recalculate other columns based on the changed value and display the updated data in the same view
For evey change that is made in the table, I don’t want all of compoennts to reload.
I only want my table component to reload after I have made all the changes.
I am struck on this issue from a long time. Please help.
Attaching an example that I came across-
This is the exact functionality I am looking for with the exception that I want some recalculations in other columns based on the edited value and it should be shown in the same view and not as a separate table that is popping up in this app.
You can try to re-assign new set of values to the existing column (that is you are assigning the new values to an existing column) via something like:
df["column_name"] = [1,2,3,4,5] # Updated list of values
In regards to the second point:
As the app logic of Streamlit is to rerun the app from top to bottom with every widget interaction, what you can do to circumvent this is to apply caching so that calculations, plots, or data would not have to be loaded/created from scratch and rather can be pulled from the cache in subsequent app refreshes.
Widget values can be assigned to session state variables so that when the app refreshes, it will be able to retrieve the widget values from session state variables so that it would appear to instantly load upon app refreshes.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.