AnilNiraula commited on
Commit
9c66ae0
·
verified ·
1 Parent(s): d0ea0a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -23,7 +23,13 @@ except Exception as e:
23
  all_data = {ticker: pd.DataFrame() for ticker in tickers} # Initialize empty DataFrames on failure
24
 
25
  # Create a DataFrame with 'Adj Close' columns for each ticker using pd.concat to handle varying lengths
26
- adj_close_data = pd.concat([data['Close'].rename(ticker) for ticker, data in all_data.items() if not data.empty], axis=1)
 
 
 
 
 
 
27
 
28
  # Display the first few rows to verify (for debugging; remove in production)
29
  print(adj_close_data.head())
 
23
  all_data = {ticker: pd.DataFrame() for ticker in tickers} # Initialize empty DataFrames on failure
24
 
25
  # Create a DataFrame with 'Adj Close' columns for each ticker using pd.concat to handle varying lengths
26
+ series_list = []
27
+ for ticker, data in all_data.items():
28
+ if not data.empty:
29
+ s = data['Close']
30
+ s.name = ticker
31
+ series_list.append(s)
32
+ adj_close_data = pd.concat(series_list, axis=1)
33
 
34
  # Display the first few rows to verify (for debugging; remove in production)
35
  print(adj_close_data.head())