yahooquery icon indicating copy to clipboard operation
yahooquery copied to clipboard

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

Open chfiii opened this issue 1 year ago • 3 comments

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 avatar Feb 02 '24 23:02 chfiii

This would be fixed by PR #262

maread99 avatar Feb 03 '24 23:02 maread99

Excellent. Thanks for getting it done so quickly. Sent from my iPhoneOn Feb 3, 2024, at 6:24 PM, Marcus Read @.***> wrote: This would be fixed by PR #262

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

chfiii avatar Feb 04 '24 00:02 chfiii