yfinance: earnings_date failing (KeyError: 'Earnings Date')
Describe bug
The earnings_dates record is not available
Simple code that reproduces your problem
import yfinance as yf msft = yf.Ticker(‘MSFT’) msft.earnings_dates
Debug log
Bad data proof
No response
yfinance version
yfinance 0.2.38
Python version
python3.10
Operating system
ubuntu
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 50 (2 by maintainers)
Bad news: Yahoo is changing their layout again.
Good news: there’s a new URL that displays all earnings dates, hopefully a quick change for a fix.
Old URL: https://finance.yahoo.com/calendar/earnings?symbol=GOOG&offset=0&size=100 New URL: https://finance.yahoo.com/calendar/earnings?day=2024-12-04&symbol=GOOG&offset=0&size=100
(Adding the day parameter gets a different layout, that displays the whole list of earning dates.)
Like @AlphaGit said, Yahoo changed their API route and their table formatting. To fix this bug, make these two changes in base.py :
Load the datetime package in base.py :
from datetime import dateReplace these lines (576 to 661) in base.py:
I’m not a contributor, so if you are one and you’re reading this, feel free to commit this change and link this issue with your commit. As a side note, this fix only supports Eastern U.S. Time (EDT/EST) earnings dates for now. Edit : Renamed “Surprise (%)” into “Surprise(%)” and to make it consistent with the previous output columns naming conventions.
The filter works only when you are logged in.
There are systematic errors across many different tickers on the Yahoo Finance website. Yahoo Finance devs must have changed something somewhere and didn’t realize they broke anything. They should have done regression tests and they didn’t.
In the meantime, until they fix the error, I would suggest finding a source of data outside of Yahoo Finance (if you really need the data).
Great for the new URL! Quick notice, after looking closer to the earnings dates, the dates are either 1 day behind or 1 day ahead. Data is inacurate. I guess that they are still working on it…
Yahoo has changed table structure
Event name is nice addition, but losing dates a problem. Hoping for a way to get old structure.
Probably Yahoo has broken their redesign rollout, because their
Find earnings for symbolsearch doesn’t work: https://finance.yahoo.com/calendar/earnings?symbol=MSFTI contacted the Yahoo Finance Data support team ; they didn’t seem to be aware there were any errors in their data. They said they’ll check it out, I’ll keeep you posted.
For anyone struggling to extract the earnings from yfinance right now, I have this little snippet that got me out of trouble. It’s not a drop-in replacement for yfinance, but those, like me, that needed to get the historical earnings to another platform, this might save you some trouble while this gets fixed.
symbolparameter in the URLYou can remove the
filter()line if you don’t want to filter future earning dates. Or, change the direction of that comparison if you only want future earnings (for me, I only want past ones).Hope this helps.
I just tried logging into yahoo and it showed me the normal earnings dates, so that might be a good solution
I get them from Zack’s. Here’s a link to Agilent’s earnings calendar from Zacks for example. If you cross reference with the company’s investor relations page on their website, you’ll see that when it comes to past earnings dates, Yahoo is wrong whereas Zacks is correct. On the other hand, when it comes to future earnings data, Yahoo is correct whereas Zacks is wrong.
So I get my past earnings data from Zacks but my future earnings dates from Yahoo, as a workaround until Yahoo correct their bug.
True, when logged in to Yahoo is works fine. I also found that replacing: dates = stock.earnings_date with: date = stock.calendar[‘Earnings Date’][0] worked for me.
I’m in the US. cTicker.earnings_dates() isnt giving me anything, but cTicker.earnings_history() does. (It just doesnt show me the future earnings dates…)
If you go on the link with your browser you should see this:
Which is the correct old format. However if you click on “Clear” which clear the filter you get what python request get:

The issue is that python request don’t get the same view as with your browser even though there is the filter attributes in the get parameters.
There is some post-processing javascript that is not executed. Even with Selenium it doesn’t get the right filtered table.
The data return by python request doesn’t execute the filter that you would have on a browser: https://finance.yahoo.com/calendar/earnings?symbol=GOOGL&offset=0&size=12
This is why “Earnings Date” is not there. The javascript needs to be executed.
Yes, it is failing for me for multiple (50+) tickers (starting yesterday/last night)
Did the table structure blow up again. I’m getting an error
As of today, some tickers work perfectly fine, some tickers give the ‘Earnings Date’ KeyError.
It returned to normal, interesting!
I suspect it will return, I’ve seen this alternative table randomly rarely over last few weeks. Yahoo is up to something…