Preview:
# Initialize session state for earnings_df
if 'earnings_df' not in st.session_state:
    st.session_state['earnings_df'] = pd.DataFrame()

# Get the filename from user input
filename = st.text_input("Enter the CSV filename:", 'msftq2.csv')

# Load the data only after pressing the 'Load File' button
if st.button('Load File', key='load_file'):
    st.session_state['earnings_df'] = load_data(filename)
    st.success("File loaded successfully!")
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter