-
-
Save treuille/e8f07ebcd92265a68ecec585f7594918 to your computer and use it in GitHub Desktop.
import streamlit as st | |
import pandas as pd | |
# Load some example data. | |
DATA_URL = \ | |
"http://s3-us-west-2.amazonaws.com/streamlit-demo-data/uber-raw-data-sep14.csv.gz" | |
data = st.cache(pd.read_csv)(DATA_URL, nrows=1000) | |
# Select some rows using st.multiselect. This will break down when you have >1000 rows. | |
st.write('### Full Dataset', data) | |
selected_indices = st.multiselect('Select rows:', data.index) | |
selected_rows = data.loc[selected_indices] | |
st.write('### Selected Rows', selected_rows) |
Right now, you need to use a separate GUI element to select the row, which is what this gist shows. When we get the row-selectable dataframe, you will be able to select directly. If you have further questions about how to solve this scenario via Streamlit I would suggest the forums (discuss.streamlit.io) where a lot of people besides me can help you out! :)
…
On Wed, Jun 10 2020 at 12:58 PM, Ebrahim H Ghazvini Zadeh < @.*** > wrote: @.**** commented on this gist. Hi, again! Is there a way to input instead of selecting a row based on certain ID because my dataframe is a 100k row — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub ( https://gist.github.com/e8f07ebcd92265a68ecec585f7594918#gistcomment-3337540 ) , or unsubscribe ( https://github.com/notifications/unsubscribe-auth/AAMYONLF7MSMRWYOJ6U2KDDRV7QXBANCNFSM4JHBEHTA ).
Alright, thank you.
@treuille I think I got around that by letting user input an ID and grabbing the whole row, I think selecting might be a bit too much given that I have a100k of them. My goal is to let the user simulate based on new input that they can adjust and that is passed through a ML model that is pickled along the code. I am having trouble with the part where after grabbing a row from the data frame, "populating" it in a slider and whatnot, as soon as I change it to a new value, the page restarts back. Here is a snippet of my code, could you please guide me onto how to solve this: