I want to have a dataframe with columns that are editable, in particular, the last column should be named “manual entry” where user can key in free text.
I got as far as this in the prototype function below. But the text input button is not embedded in the column of the table itself. I have also heard of streamlit-aggrid but did not try yet, appreciate any help.
import streamlit as st
import pandas as pd
@st.cache
def convert_df(df):
return df.to_csv().encode("utf-8")
def prototype_2():
columns = ["A", "B", "C", "manual entry"]
df = pd.DataFrame(
data=[
[1, 2, 3, st.text_input("row1")],
[4, 5, 6, st.text_input("row2")],
],
columns=columns,
)
show_df = st.dataframe(df)
csv = convert_df(df)
st.download_button(
"Press to Download", csv, "file.csv", "text/csv", key="download-csv"
)
if __name__ == "__main__":
# prototype_1()
prototype_2()