admin管理员组文章数量:1332383
In finance as I am learning we have Sectors and within the Sectors we have Industries.
I am trying to get the Market Cap through the yfinance API through the following code:
import yfinance as yf
tech = yf.Sector('technology')
software = yf.Industry('software-infrastructure')
print(tech.overview)
But the answer is:
AttributeError: module 'yfinance' has no attribute 'Sector'`
May it be related with yfinance API instead of my usage?
I am applying what's written in the documentation.
In finance as I am learning we have Sectors and within the Sectors we have Industries.
I am trying to get the Market Cap through the yfinance API through the following code:
import yfinance as yf
tech = yf.Sector('technology')
software = yf.Industry('software-infrastructure')
print(tech.overview)
But the answer is:
AttributeError: module 'yfinance' has no attribute 'Sector'`
May it be related with yfinance API instead of my usage?
I am applying what's written in the documentation.
Share edited Nov 22, 2024 at 18:18 SinonCuriosus asked Nov 22, 2024 at 5:11 SinonCuriosusSinonCuriosus 11 bronze badge 2- 1 Where did you get yfinance? What version is it? What version of Python? It has been a fairly dynamic package as Yahoo changes its rules periodically. – Tim Roberts Commented Nov 22, 2024 at 6:16
- The yfinance version I had was "0.2.40" I've just upgraded it to the newest that is "0.2.50" and it worked! Lesson: When the documentation says something, just checkout if your package is the most updated, just passed by me. Much appreciated your time Tim! – SinonCuriosus Commented Nov 22, 2024 at 11:04
1 Answer
Reset to default 0It seems that I was working with a deprecated yfinance version.
I've solved it by upgrading the package through the command "pip install --upgrade yfinance" as Tim raised under the comments.
本文标签: yfinanceProblem when trying to get Sector Market CapStack Overflow
版权声明:本文标题:yfinance - Problem when trying to get Sector Market Cap - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742296055a2448748.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论