我有一个共享列表,我想循环使用它们来获取今天的卷使用pdr.get_data_yahoo这是我的代码
volist=[]
today = str(datetime.date.today())
for col in df.columns:#df.colomuns is the list of shares
vol = pdr.get_data_yahoo(col,start=today,end=today)['Volume']
volist.append(vol)
但是我收到错误消息:KeyError:'Date'我怀疑有些股票没有可用的卷数据......次要问题:我也想编译一个数据框,其中包含共享名称(即“col”)作为索引,并将卷作为值编译像这样:
share
BAP.AX 937459
CGC.AX 902398
NST.AX 876727
OML.AX 900462
ORA.AX 881516
我如何使用循环来实现这一目标?