Hi, anyone can help me on how to create user input column names in a dataframe. Currently I’m using Ag-Grid library for streamlit. The code is:
if 'num' not in st.session_state:
st.session_state.num = 1
numrow = st.number_input("Number of row", min_value=0, max_value=50)
numcol = st.number_input("Number of Column", min_value=1, max_value=50)
col = []
num = st.session_state.num
col_name = st.text_input("Column Name", key=num)
for i in range(int(numcol)):
col.append(col_name)
df_template = pd.DataFrame(
'',
index=range(int(numrow)),
**columns= list(col_name)**
)
with st.form('dataset') as f:
st.header('Your dataset')
response = AgGrid(df_template, editable=True, fit_columns_on_grid_load=True)
st.form_submit_button()
st.write(response['data'])```
Output is as in image captured.
![Screenshot from 2022-08-10 15-59-06|513x499](upload://w6VmuZdsctETveIzCpwopkmZYSF.png)
I want user to be able to insert their column name. Can someone help me to solve this? Thanks in advance!