JayLacoma commited on
Commit
05b5af5
·
verified ·
1 Parent(s): 8f87510

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -250,6 +250,13 @@ def stock_analysis(ticker, start_date, end_date):
250
  # Download stock data from Yahoo Finance
251
  df = yf.download(ticker, start=start_date, end=end_date)
252
 
 
 
 
 
 
 
 
253
  # Generate signals
254
  df = generate_trading_signals(df)
255
 
@@ -293,7 +300,4 @@ with gr.Blocks() as demo:
293
  outputs=[combined_signals_output, individual_signals_output])
294
 
295
  # Launch the interface
296
- demo.launch()
297
-
298
-
299
-
 
250
  # Download stock data from Yahoo Finance
251
  df = yf.download(ticker, start=start_date, end=end_date)
252
 
253
+ # If the DataFrame has a MultiIndex for columns, drop the 'Ticker' level
254
+ if isinstance(df.columns, pd.MultiIndex):
255
+ df.columns = df.columns.droplevel(level=1) # Drop the 'Ticker' level
256
+
257
+ # Explicitly set column names (optional)
258
+ df.columns = ['Close', 'High', 'Low', 'Open', 'Volume']
259
+
260
  # Generate signals
261
  df = generate_trading_signals(df)
262
 
 
300
  outputs=[combined_signals_output, individual_signals_output])
301
 
302
  # Launch the interface
303
+ demo.launch()