os1187 commited on
Commit
45ab29a
1 Parent(s): 976b979

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -15
app.py CHANGED
@@ -46,6 +46,16 @@ def calculate_combined_scores_for_stocks(stocks, index_averages):
46
  scores.append({'Stock': ticker_symbol, 'Combined Score': score})
47
  return pd.DataFrame(scores)
48
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  # User interface in Streamlit
51
  st.title('S&P 500 Stock Comparison Tool')
@@ -88,18 +98,3 @@ with col2:
88
  average = sp500_averages.loc[ratio, 'Average'] if ratio in sp500_averages.index else 'N/A'
89
  comparison_result = comparison[ratio] if ratio in comparison else 'N/A'
90
  st.write(f"{ratio}: {value} (Your Ratio) | {average} (S&P 500 Avg) - {comparison_result}")
91
-
92
- # Define the color-coding function for the 'Combined Score' column
93
- def color_combined_score(value):
94
- """Colors the combined score cell based on its value."""
95
- if value > 0:
96
- color = 'green'
97
- elif value < 0:
98
- color = 'red'
99
- else:
100
- color = 'none'
101
- return f'background-color: {color};'
102
-
103
-
104
-
105
-
 
46
  scores.append({'Stock': ticker_symbol, 'Combined Score': score})
47
  return pd.DataFrame(scores)
48
 
49
+ # Define the color-coding function for the 'Combined Score' column
50
+ def color_combined_score(value):
51
+ """Colors the combined score cell based on its value."""
52
+ if value > 0:
53
+ color = 'green'
54
+ elif value < 0:
55
+ color = 'red'
56
+ else:
57
+ color = 'none'
58
+ return f'background-color: {color};'
59
 
60
  # User interface in Streamlit
61
  st.title('S&P 500 Stock Comparison Tool')
 
98
  average = sp500_averages.loc[ratio, 'Average'] if ratio in sp500_averages.index else 'N/A'
99
  comparison_result = comparison[ratio] if ratio in comparison else 'N/A'
100
  st.write(f"{ratio}: {value} (Your Ratio) | {average} (S&P 500 Avg) - {comparison_result}")