大家好!
我将上图中的excel表格导入python生成一个Dataframe
现在我要使用Tushare的行情查询A列中每个股票在日期start_date的收盘价,并填入start_date_price列的相应行中.
我的代码如下:
df = pd.read_csv('D:/private/stock investment/st_research.csv')
for x,y in df['ts_code'],df['start_date']:
result=ts.pro_bar(ts_code=x, adj='qfq',start_date=y)
#将查询到的收盘价填入start_date_price列的相应行中
df.loc[df[df.ts_code == x].index.tolist(),‘start_date_price’] = result.loc[0,'close']
print(df.head())
报错信息如下图:
请问是什么原因,如何解决?谢谢!