Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Refresh button using streamlit. Had to click on refresh twice to make it work

$
0
0

How to make it work on single click.

import streamlit as stimport pandas as pdimport numpy as np# Function to read DataFrame from CSVdef read_dataframe():    return pd.read_excel(r"E:\projects\smartscan2_1\patients_info.xlsx")def main():    st.title("Refresh DataFrame Example")    # Generate or retrieve the DataFrame    if 'data' not in st.session_state:        st.session_state.data = read_dataframe()    # Display the DataFrame    st.dataframe(st.session_state.data)    # Add a refresh button    if st.button("Refresh"):        # Read the DataFrame from CSV and store it in session_state        st.session_state.data = read_dataframe()if __name__ == "__main__":    main()

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>