[英]How to get Industry Data from Yahoo Finance using Python?
I currently have some tickers and data from yahoo finance gained through datareader for Python.我目前有一些来自 yahoo finance 的代码和数据,这些代码和数据是通过 Python 的数据阅读器获得的。 I have got everything for the dataframe in relation to numbers except the industry from the profile of the ticker.我已经从代码的配置文件中获得了与数字相关的数据框的所有内容,但行业除外。 I was wondering if there is any code that would work that would show the industry for the following ticker displayed through the profile page of yahoo?我想知道是否有任何代码可以显示通过雅虎的个人资料页面显示的以下代码的行业?
Code Below:代码如下:
import pandas_datareader.data as pdr
Tickers=['SBUX','TLRY']
SD='2005-01-31'
ED='2018-12-31'
TickerW=pdr.datareader(Tickers,'yahoo',SD,ED)
TickerW.head()
This cannot be done with pandas_datareader see here .这不能用 pandas_datareader 看到这里完成。 You could use yfinance instead to get the sector.您可以改用yfinance来获取该部门。
as an example try:例如尝试:
import yfinance as yf
sbux = yf.Ticker("SBUX")
tlry = yf.Ticker("TLRY")
print(sbux.info['sector'])
print(tlry.info['sector'])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.