So verwende ich diese series auf Python für Finanzen und es hält was mir Fehler -Automatisieren der S & P-500-Liste immer
1) line 22, in <module> save_sp500_tickers() and
2) line 8, in save_sp500_tickers
soup = bs.BeautifulSoup(resp.text,'lxml')and
3) line 165, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml.
Do you need to install a parser library?
Ich habe einen ganzen Tag lang an ihm gewesen, und ich ehrlich aufgeben verweigern und jede Hilfe mit diesem würde sehr appelliert werden. Auch wenn jemand irgendwelche Vorschläge für etwas anderes als Gurke hat und mir helfen kann, etwas zu schreiben, das mir erlaubt, den SP500 ohne Gurke zu nennen, wäre das großartig.
import bs4 as bs
import pickle
import requests
import lxml
def save_sp500_tickers():
resp = requests.get('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')
soup = bs.BeautifulSoup(resp.text,'lxml')
table = soup.find('table', {'class': 'wikitable sortable'})
tickers = []
for row in table.findAll('tr')[1:]:
ticker = row.findAll('td')[0].text
tickers.append(ticker)
with open("sp500tickers.pickle", "wb") as f:
pickle.dump(tickers, f)
print(tickers)
return tickers
save_sp500_tickers()
Hinweis liegt im Fehler. 'Müssen Sie eine Parser-Bibliothek installieren?' –