I have a dataset and I want to delete some rows in the dataset according to the index. For this, I created an interface with the code below:
st.subheader("Edit Your Dataset") if st.checkbox(label = "Run Edit Engine"): idx = st.number_input("Edit by Index", format="%i", value=0, max_value=dataset.shape, step=1) if st.button("Drop the Row"): dataset.drop(index=idx, axis=0, inplace=True) st.success("The Record was deleted.") st.write(dataset)
First, I enter the index of the row I want to be deleted and then press the ‘Drop the row’ button:
Then the row was deleted:
After this process, I want to delete one more row and I enter the index again and click the button:
However, in the last table, the row I deleted in the previous process is not actually deleted, only my last process is valid.
How can I edit my dataset using only one button for multiple actions?