Created
October 30, 2019 22:18
-
-
Save treuille/e8f07ebcd92265a68ecec585f7594918 to your computer and use it in GitHub Desktop.
Workaround: Selecting rows from a dataframe.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alright, thank you.