嵌套 pandas 个迭代行,涉及动态数据框对象

nested pandas iterrows involving on-the-fly dataframe objects

我的脚本接受了 'live' F500 公司的在线列表,遍历每个代码,在定义的时间段内获取代码表现。我想不通的是如何 schema/store 进入二维列表,每个符号有多行行情数据。不知何故,第二个 iterrows 将无法运行。提前致谢:

import pandas as pd #dataframe extends from pd
import pandas_datareader.data as web #grabs stock data
import datetime as dt #to specify date range for grab

#VARS:
#url to f500 list
data_url = "https://query.data.world/s/vjghzuarkh6dap3dblkxanppyh5jtl" 
source = "yahoo" 
start = dt.datetime(2019, 2, 13) #datetime type
end = dt.datetime.now()    
results = []

#read into memory
df500 = pd.read_csv(data_url)

for index, row in df500.tail().iterrows(): 

    try:

        dfdr = web.DataReader(row['SYMBOL'], source, start, end) #returns a dataframe presumably

        for index2, row2 in dfdr().iterrows(): 
            # here i want to append to the results list: row['SYMBOL'], row2['Date'], row2['High']
            print ("test output ", row2[0]) #not even this works

    except Exception as e: 
        pass

# commit to sqlite3 from list or df

这里dfdr后面的括号是错误的:

dfdr().iterrows()

应该是:

dfdr.iterrows()