Summary
Using the example code from tutorial to show the uber data on NY map. After inserting the slider code I was expecting to see the map refresh based on the value from the slider. But it only refreshes if I resize and reset the map.
Steps to reproduce
Code snippet:
st.title('Uber pickups in NYC')
DATE_COLUMN = 'date/time'
DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
@st.cache_data
def load_data(nrows):
data = pd.read_csv(DATA_URL, nrows=nrows)
lowercase = lambda x: str(x).lower()
data.rename(lowercase, axis='columns', inplace=True)
data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
return data
data_load_state = st.text('loading data ...')
data = load_data(10000)
data_load_state.text('done (cached data).')
if st.checkbox('show raw data'):
st.subheader('Raw data')
st.write(data)
st.subheader('Number of pickups by hour')
hist_values = np.histogram(
data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
st.bar_chart(hist_values)
hour_to_filter = st.slider('hour', 0, 23, 6) # min: 0h, max: 23h, default: 17h
st.subheader(f'Map of all pickups at {hour_to_filter}:00')
filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
st.write(f'read nrows: {len(filtered_data)}')
st.map(filtered_data)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
Explain what you expect to happen when you run the code above.
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If youβre seeing an error message, share the full contents of the error message here.
Debug info
- Streamlit version: (get it with
$ streamlit version
) - Python version: (get it with
$ python --version
) - Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app: https://rakesh-k-streamlit-example-streamlit-app-y4qpgs.streamlit.app
Additional information
If needed, add any other context about the problem here.