Web Scraping - 股票价格,quandl
Web Scraping - stock prices, quandl
我有一个简短的问题。我的代码如下所示:
import quandl
names_of_company = ['KGHM','INDYKPOL','KRUK','KRUSZWICA']
for names in names_of_company:
x = quandl.get('WSE/{names_of_company}', start_date='2018-11-26',
end_date='2018-11-29')
我试图在一个输出中获取所有数据,但我无法一个接一个地更改每家公司的名称。你有什么想法吗?
感谢帮助
除非我遗漏了什么,看起来你应该能够做一个非常基本的 for
循环。是语法不正确。
import quandl
import pandas as pd
names_of_company = ['KGHM','INDYKPOL','KRUK','KRUSZWICA']
results = pd.DataFrame()
for names in names_of_company:
x = quandl.get('WSE/%s' %names, start_date='2018-11-26',
end_date='2018-11-29')
x['company'] = names
results = results.append(x).reset_index(drop=True)
我有一个简短的问题。我的代码如下所示:
import quandl
names_of_company = ['KGHM','INDYKPOL','KRUK','KRUSZWICA']
for names in names_of_company:
x = quandl.get('WSE/{names_of_company}', start_date='2018-11-26',
end_date='2018-11-29')
我试图在一个输出中获取所有数据,但我无法一个接一个地更改每家公司的名称。你有什么想法吗?
感谢帮助
除非我遗漏了什么,看起来你应该能够做一个非常基本的 for
循环。是语法不正确。
import quandl
import pandas as pd
names_of_company = ['KGHM','INDYKPOL','KRUK','KRUSZWICA']
results = pd.DataFrame()
for names in names_of_company:
x = quandl.get('WSE/%s' %names, start_date='2018-11-26',
end_date='2018-11-29')
x['company'] = names
results = results.append(x).reset_index(drop=True)