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

Pandas 2.2.0 giving warnings in __init__.py and ticker.py #263

Open
chfiii opened this issue Feb 2, 2024 · 3 comments
Open

Pandas 2.2.0 giving warnings in __init__.py and ticker.py #263

chfiii opened this issue Feb 2, 2024 · 3 comments

Comments

@chfiii
Copy link

chfiii commented Feb 2, 2024

Describe the bug
Pandas 2.2.0 is giving the warning:
/yahooquery/utils/init.py:1470: FutureWarning: 'S' is deprecated and will be removed in a future version. Please use 's' instead of 'S'.
has_live_indice = index_utc[-1] >= last_trade - pd.Timedelta(2, "S")

Also getting waning in ticker.py:11333 and 1335:
ticker.py:1335: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.

For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.

df["splits"].fillna(0, inplace=True)

To Reproduce
Steps to reproduce the behavior:
Here's the test code:
from yahooquery import Ticker
tic = Ticker('AAPL')
history = tic.history(period='1day')

Expected behavior
History should be set with the data

  • OS: wsl2 on Windows 11
  • Python 3.9.18 (Anaconda3)
  • Pandas: 2.2.0 (Anaconda)

FIX
Changed the "S" to "s' at line 1470 in intit.py as stated by the warning and this fixed it
Changed ticker.py:1333 to: df.fillna({"dividends":0}, inplace=True)
and ticker.py:1335 to df.fillna({"splits":0}, inplace=True)

NOTE that there may be other instances of this, these are the ones I've encountered so far

@chfiii chfiii changed the title Pandas 2.2.0 giving warings in __init__.py Pandas 2.2.0 giving warnings in __init__.py Feb 2, 2024
@chfiii chfiii changed the title Pandas 2.2.0 giving warnings in __init__.py Pandas 2.2.0 giving warnings in __init__.py and ticker.py Feb 2, 2024
@maread99
Copy link
Contributor

maread99 commented Feb 3, 2024

This would be fixed by PR #262

@chfiii
Copy link
Author

chfiii commented Feb 4, 2024 via email

@chfiii
Copy link
Author

chfiii commented Aug 18, 2024

It is now August 18th. The fix for the Pandas warnings in PR #262 has not yet been released. When will this happen?

m1pro added a commit to m1pro/yahooquery that referenced this issue Sep 24, 2024
Main repo is not active in updating the PR to fix the above.
Fix in fork.
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

2 participants