Financial Data with Python: yfinance

Поделиться
HTML-код
  • Опубликовано: 8 июн 2024
  • In this video we take a look at financial data with python using the yfinance package.

Комментарии • 99

  • @Savrina-wr7ki
    @Savrina-wr7ki День назад +1

    Thank you! It's very useful🥰

  • @michealkinney6205
    @michealkinney6205 2 года назад +12

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

  • @Dongnanjie
    @Dongnanjie 6 месяцев назад

    Loved it. Thank you sir!

  • @dnyaneshwar53
    @dnyaneshwar53 Год назад +2

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

  • @AhmedGamal-mi1ns
    @AhmedGamal-mi1ns 5 месяцев назад +1

    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 2 месяца назад

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

  • @hemantsharma7433
    @hemantsharma7433 2 года назад +4

    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  2 года назад +3

      Thank you! I have a playlist of more finance related videos. Check them out here:
      ruclips.net/p/PLlbbWgBRF8EfO4WX13yEWlDUxkHsGPRdV

  • @theCanadian808
    @theCanadian808 2 года назад

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

  • @anushervonsharifov588
    @anushervonsharifov588 2 года назад +2

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

  • @surendrapanchal5608
    @surendrapanchal5608 Год назад

    great video

  • @rohitkamble8515
    @rohitkamble8515 2 года назад +2

    Thanks for sharing the information 😊

  • @linghaoyi
    @linghaoyi 2 года назад +1

    Great video

  • @2255.
    @2255. Год назад

    this is amazing

  • @Attapattu
    @Attapattu 6 месяцев назад

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

  • @MONIQUE_MUSIC
    @MONIQUE_MUSIC Год назад

    Thank you so much 🙂

  • @user-pj1gv4ky3u
    @user-pj1gv4ky3u 6 месяцев назад

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

  • @mankitlau3388
    @mankitlau3388 2 года назад +1

    This is so great

  • @Jerrel.A
    @Jerrel.A Год назад

    Thanks a lot!

  • @andBetoo
    @andBetoo 2 года назад +1

    33:56 haha
    Greetings from Chile :P

  • @edgaralexanderhernandezreb4261
    @edgaralexanderhernandezreb4261 2 года назад +1

    thnks!

  • @milenium9503
    @milenium9503 8 месяцев назад

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

  • @aarondelarosa3146
    @aarondelarosa3146 Год назад

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

  • @Cowbeba
    @Cowbeba Год назад

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

  • @AnimeAsLeaders998
    @AnimeAsLeaders998 Год назад +1

    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)

  • @samialkhammash1985
    @samialkhammash1985 Год назад

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

  • @jesusgomezbranagonzalez4892
    @jesusgomezbranagonzalez4892 2 месяца назад

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

  • @DiegoTorres-jw8xo
    @DiegoTorres-jw8xo 3 года назад +3

    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 года назад +9

      I liked your comment so much I made a video. Here you go!
      ruclips.net/video/K_JQlIDzBpY/видео.html

    • @DiegoTorres-jw8xo
      @DiegoTorres-jw8xo 3 года назад

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

  • @alexr3650
    @alexr3650 2 года назад +1

    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.

  • @mohammedalashour5796
    @mohammedalashour5796 Год назад +1

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

  • @antonglo7883
    @antonglo7883 2 года назад +1

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

  • @whitedancer5866
    @whitedancer5866 Год назад

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

  • @Kig_Ama
    @Kig_Ama 2 года назад

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

  • @brunob8473
    @brunob8473 Год назад

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

  • @caz6528
    @caz6528 2 года назад +2

    can you make a candle stick chart

  • @e.s.1651
    @e.s.1651 Год назад

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

  • @ameliegem7405
    @ameliegem7405 2 года назад +2

    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  2 года назад

      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 2 года назад +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 2 года назад +1

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

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад +1

      @@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.

  • @hobbyphile
    @hobbyphile 2 года назад +1

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

  • @_TusharBansal
    @_TusharBansal Год назад

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

  • @miguelangeldiazoviedo9523
    @miguelangeldiazoviedo9523 2 года назад +1

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

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад +1

      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()

  • @alicezanesi1831
    @alicezanesi1831 2 года назад +1

    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  2 года назад +1

      I made a video about grabbing all of the stock data for a specific index here: ruclips.net/video/K_JQlIDzBpY/видео.html.
      You could modify this example using the FTSE MIB wiki page.

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад

      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

  • @Myhands14
    @Myhands14 2 года назад +1

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

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад +1

      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.

  • @smartinvestor8791
    @smartinvestor8791 Год назад +1

    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 7 месяцев назад

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

  • @jasonyu8020
    @jasonyu8020 2 года назад +2

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

  • @kenny9597
    @kenny9597 2 года назад +1

    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 года назад +1

      @@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 :(

  • @burakbektas4254
    @burakbektas4254 2 года назад +1

    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.

  • @marcomorganti4923
    @marcomorganti4923 2 года назад +1

    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

  • @diophantine6677
    @diophantine6677 2 года назад +1

    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.

  • @MarkEm
    @MarkEm Год назад

    What IDE is that?

  • @caz6528
    @caz6528 2 года назад +1

    yfinance dosent download properly any fixes?

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад

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

  • @ye-ym5jo
    @ye-ym5jo 2 года назад

    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 Год назад

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

  • @blankerhans9659
    @blankerhans9659 2 года назад +1

    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.

  • @cristiancarcamo2872
    @cristiancarcamo2872 3 года назад +1

    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 2 года назад

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

  • @user-lf4bk6kj9k
    @user-lf4bk6kj9k 2 года назад +1

    How can fetch all stocks and futures?

    • @DataScienceforEveryone
      @DataScienceforEveryone  2 года назад

      Take a look here. I think this is what you are looking for. ruclips.net/video/K_JQlIDzBpY/видео.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
    @deepsudeep 2 года назад +1

    Rut did not get delisted for sure ☺

  • @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