Hi everyone, I have my editable dataframe created but I want to be able to calculate the total user input from each cell and show it in the rightmost cell as “total”. I want a reset button to make everyone 0 when pressed. Calculate should calculate total. Thanks in advance.
add code here
# Import python packages
import streamlit as st
from snowflake.snowpark.context import get_active_session
#calculate button
if st.button("Calculate"):
df['Total'] = df['DOI'] + df['DOI+1']+ df['DOI+2']+df['DOI+3']
if st.button("Reset"):
df['Total'] = df['DOI'] + df['DOI+1']+ df['DOI+2']+df['DOI+3*']
st.subheader("Current Liquidity Need")
#create dataframe with input data and input columns
dataframe_three = session.create_dataframe(
[["ROW 1","","","","",""],
["ROW 2","","","","",""]],
schema= [" ", "COLUMN1","COLUMN2","COLUMN3","COLUMN4","Total"]
)
# Execute the query and convert it into a Pandas dataframe
queried_data_three = dataframe_three.to_pandas()
styled_data = queried_data_three.style.set_properties(**{'border':'none','border-collapse':'collapse'})
#display dataframe for editable columns
st.experimental_data_editor(styled_data)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
**Expected behavior:**
Explain what you expect to happen when you run the code above.
I expect the user to add in values they want to in row 1 and 2 under the column names and those two totals get calculated in the right most box in each row. The reset button should reset everything to 0.
**Actual behavior:**
Buttons aren't working. Sum formula doesn't work.