Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect before get earning #2164

Closed
iometrine opened this issue Dec 3, 2024 · 1 comment
Closed

Connect before get earning #2164

iometrine opened this issue Dec 3, 2024 · 1 comment

Comments

@iometrine
Copy link

Describe bug

The earnings_dates record is not available

Simple code that reproduces your problem

yfinance.Ticker.earnings
yfinance.Ticker.get_earnings
yfinance.Ticker.get_earnings_dates

Debug log

/usr/local/lib/python3.9/dist-packages/yfinance/scrapers/fundamentals.py:33: DeprecationWarning: 'Ticker.earnings' is deprecated as not available via API. Look for "Net Income" in Ticker.income_stmt.
warnings.warn("'Ticker.earnings' is deprecated as not available via API. Look for "Net Income" in Ticker.income_stmt.", DeprecationWarning)
none

or this for get_earnings_dates :
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 3805, in get_loc
return self._engine.get_loc(casted_key)
File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Earnings Date'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/var/www/python/sample_earnings.py", line 23, in
list = ticker.get_earnings_dates(limit=48)
File "/usr/local/lib/python3.9/dist-packages/yfinance/utils.py", line 104, in wrapper
result = func(args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/yfinance/base.py", line 631, in get_earnings_dates
tzinfo = dates[cn].str.extract('([AP]M[a-zA-Z]
)$')
File "/usr/local/lib/python3.9/dist-packages/pandas/core/frame.py", line 4102, in getitem
indexer = self.columns.get_loc(key)
File "/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py", line 3812, in get_loc
raise KeyError(key) from err
KeyError: 'Earnings Date'

Bad data proof

so we get this error because i think we need to log into with an yahoo account.
How can use this api in connecting me before via python ?

yfinance version

0.2.50

Python version

No response

Operating system

linux

@dhruvan2006
Copy link
Contributor

Duplicate #1932

@ValueRaider ValueRaider closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants