os1187 commited on
Commit
219f5c2
·
verified ·
1 Parent(s): 958b14a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -26,21 +26,17 @@ def fetch_stock_data(ticker_symbol):
26
  }
27
 
28
  return financials, info
 
 
29
 
30
- # ... rest of your existing functions ...
31
-
32
- # User interface in Streamlit
33
- st.title('S&P 500 Stock Comparison Tool')
34
-
35
- # Check if companies are in the S&P 500
36
- @st.cache
37
  def get_sp500_list():
38
  table = pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
39
  return table[0]['Symbol'].tolist()
40
 
 
41
  sp500_list = get_sp500_list()
42
-
43
- # Load S&P 500 averages
44
  sp500_averages = load_sp500_averages(sp500_averages_path)
45
 
46
  # Calculate combined scores for stocks in the S&P 500
 
26
  }
27
 
28
  return financials, info
29
+ # Define the path to your CSV file
30
+ sp500_averages_path = 'sp500_averages.csv'
31
 
32
+ # Update the cache decorator
33
+ @st.experimental_memo
 
 
 
 
 
34
  def get_sp500_list():
35
  table = pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
36
  return table[0]['Symbol'].tolist()
37
 
38
+ # Use the updated cache function and define the CSV path
39
  sp500_list = get_sp500_list()
 
 
40
  sp500_averages = load_sp500_averages(sp500_averages_path)
41
 
42
  # Calculate combined scores for stocks in the S&P 500