JayLacoma commited on
Commit
69b4b8c
·
verified ·
1 Parent(s): aa99e8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -183,6 +183,14 @@ def plot_combined_signals(df, ticker):
183
  def stock_analysis(ticker, start_date, end_date):
184
  # Download stock data from Yahoo Finance
185
  df = yf.download(ticker, start=start_date, end=end_date)
 
 
 
 
 
 
 
 
186
 
187
  # Generate signals
188
  generate_trading_signals(df)
 
183
  def stock_analysis(ticker, start_date, end_date):
184
  # Download stock data from Yahoo Finance
185
  df = yf.download(ticker, start=start_date, end=end_date)
186
+
187
+ # If the DataFrame has a MultiIndex for columns, drop the 'Ticker' level
188
+ if isinstance(df.columns, pd.MultiIndex):
189
+ df.columns = df.columns.droplevel(level=1) # Drop the 'Ticker' level
190
+
191
+ # Explicitly set column names (optional)
192
+ df.columns = ['Close', 'High', 'Low', 'Open', 'Volume']
193
+
194
 
195
  # Generate signals
196
  generate_trading_signals(df)