Yfinance IndexError: list index out of range

Yfinance IndexError: list index out of range

下面的代码是我写的运行ning。第四次循环运行时,报错。它给出“IndexError:列表索引超出范围”。我该如何解决这个错误?

import yfinance as yf

dow_list = ['AAPL', 'AXP', 'BA', 'CAT', 'CSCO', 'CVX', 'DIS', 'DOW', 'GS', 'HD', 'IBM', 'INTC', 'JNJ', 'JPM', 'KO', 'MCD', 'MMM', 'MRK', 'MSFT', 'NKE', 'PFE', 'PG', 'RTX', 'TRV', 'UNH', 'V', 'VZ', 'WBA', 'WMT', 'XOM']

rows = []

for ticker in dow_list:
    stk_container = yf.Ticker(ticker)
    stk_info = stk_container.info
    print(stk_info)

回溯

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-140-46a177e9173f> in <module>
      5 for ticker in dow_list:
      6     stk_container = yf.Ticker(ticker)
----> 7     stk_info = stk_container.info
      8     print(stk_info)

e:\Anaconda3\lib\site-packages\yfinance\ticker.py in info(self)
    136     @property
    137     def info(self):
--> 138         return self.get_info()
    139 
    140     @property

e:\Anaconda3\lib\site-packages\yfinance\base.py in get_info(self, proxy, as_dict, *args, **kwargs)
    413 
    414     def get_info(self, proxy=None, as_dict=False, *args, **kwargs):
--> 415         self._get_fundamentals(proxy)
    416         data = self._info
    417         if as_dict:

e:\Anaconda3\lib\site-packages\yfinance\base.py in _get_fundamentals(self, kind, proxy)
    284         holders = _pd.read_html(url)
    285         self._major_holders = holders[0]
--> 286         self._institutional_holders = holders[1]
    287         if 'Date Reported' in self._institutional_holders:
    288             self._institutional_holders['Date Reported'] = _pd.to_datetime(

IndexError: list index out of range
import yfinance as yf

dow_list = ['AAPL', 'AXP', 'BA', 'CAT', 'CSCO', 'CVX', 'DIS', 'DOW', 'GS', 'HD', 'IBM', 'INTC', 'JNJ', 'JPM', 'KO', 'MCD', 'MMM', 'MRK', 'MSFT', 'NKE', 'PFE', 'PG', 'RTX', 'TRV', 'UNH', 'V', 'VZ', 'WBA', 'WMT', 'XOM']

rows = []

for ticker in dow_list:
    stk_container = yf.Ticker(ticker)
    try:
        stk_info = stk_container.info
        print(stk_info)  # print the info
    except IndexError as e:
        print(f'{ticker}: {e}')  # print the ticker and the error
    print('\n')