First of all, I am a beginner with python. I come across the following issue, I am able to show results from my xlsx file when I select the Models, but when I add the multi slider I canβt get any results. But if I use st.write I can get the values. I was wondering how I can get the results after selecting the models and price range. Many thank in advance.
import streamlit as st
import pandas as pd
import base64
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import time
import requests
import json
st.title('TWS features')
st.subheader('All data')
@st.cache
def load_data():
df=pd.read_excel("/Mylocation/TWS Data.xlsx")
#df=df[df['Price']>0]
twsdata = df
return twsdata
twsdata = load_data()
#st.dataframe(df.style.highlight_max(axis=0))
# Sidebar = Model Selection
sorted_unique_model = sorted(twsdata.Model.unique())
selected_model = st.sidebar.multiselect('Model', sorted_unique_model, sorted_unique_model)
# Sidebar = Price Range
min_price = int(twsdata['Price'].min())
max_price = int(twsdata['Price'].max())
#sorted_unique_price = sorted(twsdata.Price.unique())
selected_price_range = st.sidebar.slider('Select the price range', 0, 999, (0, 999), 1)
st.write('Range Values', selected_price_range)
# Filtering data
df_selected_model = twsdata[(twsdata.Model.isin(selected_model)) & (twsdata.Price.isin(selected_price_range))]
st.header('Display selected TWS')
st.dataframe(df_selected_model)