Financial Data with Python: yfinance

In this video we take a look at financial data with python using the yfinance package.

Пікірлер: 101

  • @michealkinney6205
    @michealkinney62052 жыл бұрын

    Not just a good video, this was a GREAT video! Thank you very much for the dive into yfinance, very helpful!

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    You are very welcome! Glad it was helpful!

  • @hemantsharma7433
    @hemantsharma74333 жыл бұрын

    Thanks a lot. I was previously scraping data from the website. It was automatic but took sometime using my script which required data cleaning. But I got the same with a SINGLE LINE. Damn this is good :)

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    Thank you! I have a playlist of more finance related videos. Check them out here: kzread.info/head/PLlbbWgBRF8EfO4WX13yEWlDUxkHsGPRdV

  • @theCanadian808
    @theCanadian8082 жыл бұрын

    Great Video ! If you have sometime please create more videos on Finance and Python.

  • @Dongnanjie
    @Dongnanjie8 ай бұрын

    Loved it. Thank you sir!

  • @dnyaneshwar53
    @dnyaneshwar532 жыл бұрын

    Thank you so much for Information & Greetings from INDIA 👍👍👍

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    It's my pleasure

  • @AhmedGamal-mi1ns
    @AhmedGamal-mi1ns7 ай бұрын

    This is a great informative video. I really enjoyed watching it twice. The first to get the whole Idea. The second I've practised everything. Thank you for the great content. But you have to upload more videos because your style is unique.

  • @ivanko1572

    @ivanko1572

    3 ай бұрын

    Do you find any errors on running the code on Pycharm?

  • @Savrina-wr7ki
    @Savrina-wr7kiАй бұрын

    Thank you! It's very useful🥰

  • @rohitkamble8515
    @rohitkamble85152 жыл бұрын

    Thanks for sharing the information 😊

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    My pleasure 😊

  • @surendrapanchal5608
    @surendrapanchal5608 Жыл бұрын

    great video

  • @anushervonsharifov588
    @anushervonsharifov5882 жыл бұрын

    Hi from Tajikistan thanks a lot bro I leared more from you

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    My pleasure

  • @Attapattu
    @Attapattu7 ай бұрын

    Can you please explain how you have your environment setup here? Editor etc. & output looks stunning!!

  • @user-pj1gv4ky3u
    @user-pj1gv4ky3u7 ай бұрын

    Hey! Thank you so much for this great ideo. I wanted to kindly ask how can you view the Python documentation in VS Code?

  • @2255.
    @2255. Жыл бұрын

    this is amazing

  • @linghaoyi
    @linghaoyi2 жыл бұрын

    Great video

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Glad you enjoyed it!

  • @wirtschaftswissenschaften
    @wirtschaftswissenschaften Жыл бұрын

    Thank you so much 🙂

  • @milenium9503
    @milenium950310 ай бұрын

    excellent video ! I have a big problem to access US Treasury Bonds Rate TNX : Last price , is it even possible by using yfinance API?

  • @Jerrel.A
    @Jerrel.A Жыл бұрын

    Thanks a lot!

  • @aarondelarosa3146
    @aarondelarosa3146 Жыл бұрын

    What platform are you using to run Python? Visual Studio Code is not good enough to run it.

  • @mankitlau3388
    @mankitlau33883 жыл бұрын

    This is so great

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    Thank you!

  • @Cowbeba
    @Cowbeba Жыл бұрын

    how do i get only the last balance sheet ? and how do in normalize numbers ?

  • @andBetoo
    @andBetoo2 жыл бұрын

    33:56 haha Greetings from Chile :P

  • @AnimeAsLeaders998
    @AnimeAsLeaders998 Жыл бұрын

    good content. but I'm at a loss to understand how this could help my investing efforts. I'd guess I want to know how I can apply this knowledge and data to supercharge my investing efforts. for example, calculating ROE, profit margin etc can already be done on excel, charts are already available on yahoo finance etc, screening tools are available. so how python can help me? (not trolling, just looking for answers)

  • @whitedancer5866
    @whitedancer5866 Жыл бұрын

    How do I pull financial statements? Especially since the company's inception? Yahoo finance website shows only recent 3 years.

  • @e.s.1651
    @e.s.1651 Жыл бұрын

    Is there any method to get daily short interest rates from yahoo finance on python?

  • @DiegoTorres-jw8xo
    @DiegoTorres-jw8xo3 жыл бұрын

    Hello, your video is very interesting. A question please, how can I download all the shares (Only the ticket symbol) that are in the S & P500 or NASDAQ for example AAPL, AMZN, TSLA etc.? Thank you very much and greetings from Mexico.

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    I liked your comment so much I made a video. Here you go! kzread.info/dash/bejne/fZN-s86CdN2ooLw.html

  • @DiegoTorres-jw8xo

    @DiegoTorres-jw8xo

    3 жыл бұрын

    @@DataScienceforEveryone Thank you very much brother. I already watched the video with its respective like. Regards!

  • @samialkhammash1985
    @samialkhammash1985 Жыл бұрын

    @17:30 I think if you kept that ^ sign in front of the ticker symbols, it would work

  • @sharathananthram2976
    @sharathananthram2976Ай бұрын

    Great Content, But just wanted to know how can i extract static reference data (Sedol,Ticker,ISIN, Exchange etc) in bulk.

  • @brunob8473
    @brunob8473 Жыл бұрын

    how to make the stocks list in list order and not in alphabetical order?

  • @alexr3650
    @alexr36502 жыл бұрын

    Hello, when trying to scrape these index tickers, I am getting a 'table not found' error. I have all the same dependencies, and am using jupyter, not colab. Do you think yahoo has changed something since uploading this video to prevent scraping, or am i getting something wrong? Thanks for the video!

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Sometimes the table not found is due to the fact that there is no html table on the webpage. That is if you are trying to scrape. However, if you are using yfinance to collect the data based on the ticker it most likely means that yahoo does not have the data from that ticker.

  • @caz.x_x
    @caz.x_x2 жыл бұрын

    can you make a candle stick chart

  • @Kig_Ama
    @Kig_Ama2 жыл бұрын

    3:20 can't c the adjusted close values which yfinance offers.

  • @ameliegem7405
    @ameliegem74053 жыл бұрын

    Hello! Love your video! Newbie to Python - trying to run through this but experiencing some error when trying to scrape the Major World Indices page. Basically it is saying "Value Error: No tables found" - did some Googling on comments with that error suggesting perhaps it is a dynamic table could be the issue. Is there a fix to this? Thanks!

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    Double check the url that you are passing to the pd.read_html(). "Value Error: No tables found" means that there are no

  • @brettolsson

    @brettolsson

    3 жыл бұрын

    I had the same issue. After some research, turns out that the Yahoo site apparently has a disdain for bots, so will only provide a very truncated response, but I guess it's only some of us it doesn't like. I found the following workaround on Stack Overflow, which adds a header to the read request. Since read_html() doesn't seem to support a header argument, you can use the requests module to request the html (which supports adding a header), then use read_html() to parse it. Maybe someone knows of a more elegant solution. Essentially, replace major_indices = pd.read_html("finance.yahoo.com/world-indices")[0] with the following import requests headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'} url = 'finance.yahoo.com/world-indices' r = requests.get(url, headers=headers) Seems to work for me...

  • @Myhands14

    @Myhands14

    3 жыл бұрын

    Have the same issue here. Any fix work for you?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    @@Myhands14 There was some recent API changes. If you are still having some issues. Try: pip install yfinance --upgrade --no-cache-dir

  • @chrima758

    @chrima758

    2 жыл бұрын

    @@DataScienceforEveryone not working for me.

  • @edgaralexanderhernandezreb4261
    @edgaralexanderhernandezreb42612 жыл бұрын

    thnks!

  • @justinbucsa3408
    @justinbucsa3408Ай бұрын

    Is there a Jupyter Notebook for this video?

  • @mohammedalashour5796
    @mohammedalashour5796 Жыл бұрын

    thank you for your effort, I'm wondering that what's the python environment you work on? :)

  • @danielcanaveras7703

    @danielcanaveras7703

    Жыл бұрын

    google collab

  • @alicezanesi1831
    @alicezanesi18313 жыл бұрын

    Hi, instead of working with world indices, how do i work with only italian indices? Not the best 30, but all. Is there a page with that? Thank you

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    I made a video about grabbing all of the stock data for a specific index here: kzread.info/dash/bejne/fZN-s86CdN2ooLw.html. You could modify this example using the FTSE MIB wiki page.

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    Saw a question from you but cannot seem to find it on the comments, but below is the answer you were looking for. Hope this helps. import yfinance as yf tickers = yf.Tickers('msft aapl goog') # ^ returns a named tuple of Ticker objects # access each ticker using (example) tickers.tickers['MSFT'].info tickers.tickers['AAPL'].history(period="1mo") tickers.tickers['GOOG'].actions

  • @hobbyphile
    @hobbyphile2 жыл бұрын

    Excuse my ignorance, I have no idea of the programming and python. May I ask, what interface are you using to do the analysis?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    I'm using Google Colab.

  • @hobbyphile

    @hobbyphile

    2 жыл бұрын

    @@DataScienceforEveryone Thank you so much for your kind reply

  • @antonglo7883
    @antonglo78832 жыл бұрын

    what platform were you using for the demonstration in the video?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    I'm using Google Colab.

  • @smartinvestor8791
    @smartinvestor8791 Жыл бұрын

    13:09, 28lines , I typed the codes which are exatly same with you, but It didn't work with this message, [ValueError: No tables found], What's the problem ? Can you help me?

  • @Mamuchonga01

    @Mamuchonga01

    9 ай бұрын

    Forget my ignorance,but it look like yahoo is blocking stock info, Recently,yahoo have changed it

  • @_TusharBansal
    @_TusharBansal Жыл бұрын

    Some of the functions are not working.. They are giving errors.. What should I do?

  • @miguelangeldiazoviedo9523
    @miguelangeldiazoviedo95232 жыл бұрын

    If i want the pct_change of multiple symbols downloaded fron yfinance?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    It would be best to simply download the ticker data then call the pct_change method on the dataset in order to get the needed feature. See the example below: import yfinance as yf import pandas as pd apple = yf.download("AAPL") apple_pct_change = df.pct_change()

  • @MarkEm
    @MarkEm Жыл бұрын

    What IDE is that?

  • @Myhands14
    @Myhands143 жыл бұрын

    Would a similar project to this look good on a github resume?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    It would definitely be a good start. But I would suggest making something with a little more analysis and visualization. For example, make an interactive graphic for them using the data you pulled or do a CAPM analysis et.

  • @burakbektas4254
    @burakbektas42542 жыл бұрын

    I just need to retrieve data about income statement is there any way to do it ?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Some companies have that data available via yfinance some don't. You can also scrape the data if need be.

  • @kenny9597
    @kenny95972 жыл бұрын

    Really appreciate, I am a begiinner of python and learnt a lot from this video. A question please, I duplicate your coding "major_indices..." and it shows "no tables found", how can I fix this? Thank you very much.

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Double check the web address to see if there is a table on that webpages html.

  • @FAKENUM83R

    @FAKENUM83R

    2 жыл бұрын

    @@DataScienceforEveryone it really isn't working. I don't know if it's a colab update but another time I'll try again

  • @dimmak8206

    @dimmak8206

    2 жыл бұрын

    any known fixes yet? the tutorial was great but I cannot continue

  • @FAKENUM83R

    @FAKENUM83R

    2 жыл бұрын

    @@dimmak8206 not yet :(

  • @marcomorganti4923
    @marcomorganti49232 жыл бұрын

    When i try to take the major world indicies python requires lxml package, but i have it.. 4.8.0

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Go through and update your packages. There may be an incompatibility. If not, downgrade lxml

  • @jasonyu8020
    @jasonyu80202 жыл бұрын

    Hello teacher, what is this editor? It looks jupyter, but seems like not jupyter...

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    I this video I am using Google Colab.

  • @diophantine6677
    @diophantine66772 жыл бұрын

    Why was there no information for financials/balance sheets/etc?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    It depends on the company. Some of the datasets have extra information, some do not.

  • @ye-ym5jo
    @ye-ym5jo2 жыл бұрын

    i kept getting error at tesla_data=tesla.history(period='max') AttributeError: 'Index' object has no attribute 'tz_localize' i still dont know what to do... please help me sir, thank you

  • @dnyaneshwar53

    @dnyaneshwar53

    2 жыл бұрын

    For some tickers we can't pull the data. ('infos')

  • @caz.x_x
    @caz.x_x2 жыл бұрын

    yfinance dosent download properly any fixes?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    It depends on the error you are getting. Usually you need to update the dependencies.

  • @blankerhans9659
    @blankerhans96592 жыл бұрын

    AttributeError: 'list' object has no attribute 'plot' got this error trying to plot the history.

  • @blankerhans9659

    @blankerhans9659

    2 жыл бұрын

    I solved it already so all fine good video! ^^

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    When you were downloading the data there must have been an error. The type of the data frame should be a pandas DataFrame not a list. Re-download the data and make sure the type of the data frame is correct.

  • @jesusgomezbranagonzalez4892
    @jesusgomezbranagonzalez48924 ай бұрын

    I love how in the earnings report section, you never talked once about earnings reports

  • @cristiancarcamo2872
    @cristiancarcamo28723 жыл бұрын

    Consulta Por que no salen los balances??

  • @DataScienceforEveryone

    @DataScienceforEveryone

    3 жыл бұрын

    Some of the Yahoo Finance data has the data. Some datasets do not have the data. It just depends on the company you select.

  • @portfedh

    @portfedh

    3 жыл бұрын

    @@DataScienceforEveryone Check out financialmodelingprep.com, you can get the fundamentals there. Only for US stockmarket though.

  • @user-lf4bk6kj9k
    @user-lf4bk6kj9k2 жыл бұрын

    How can fetch all stocks and futures?

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Take a look here. I think this is what you are looking for. kzread.info/dash/bejne/fZN-s86CdN2ooLw.html

  • @user-lf4bk6kj9k

    @user-lf4bk6kj9k

    2 жыл бұрын

    Thanks. I would like fetch all stocks, not just s&p 500. I'm also interested in data cleaning based on all stocks. Do you have any recommendation?

  • @Julian_XO
    @Julian_XO Жыл бұрын

    the ^ shouldn't be omitted I think, that's why it's not found

  • @deepsudeep
    @deepsudeep2 жыл бұрын

    Rut did not get delisted for sure ☺

  • @DataScienceforEveryone

    @DataScienceforEveryone

    2 жыл бұрын

    Thanks!

  • @chrima758
    @chrima758 Жыл бұрын

    'Yfinance failed to decrypt Yahoo data response' and I had to learn it is probably dead because Yahoo does not want to be nice anymore