We then set up a multiselect, which restricts the choices a user can choose from but lets them choose many (unlike an options control, where the user can only select one option). We create a set from our city column to get all the unique cities in our dataset (most are in Bern, but there are some in outlying towns too).
Filtering the data based on user input and calculating aggregate statistics
Now add the following code to your app.py file - again, below the existing code.
```python
filtered_data = data[data['num_rooms'].between(rooms_filter[0], rooms_filter[1])]
filtered_data = filtered_data[filtered_data['city'].isin(cities_filter)]
avg = filtered_data['price'].mean()
med = filtered_data['price'].median()
mn = filtered_data['price'].min()
mx = filtered_data['price'].max()
st.markdown(f"### Avg. CHF {avg:.0f} | Med. CHF {med:.0f} | Min. CHF {mn:.0f} | Max CHF {mx:.0f}")
