dpguthrie / yahooquery

Python wrapper for an unofficial Yahoo Finance API
https://yahooquery.dpguthrie.com
MIT License
766 stars 137 forks source link

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

Open chfiii opened 7 months ago

chfiii commented 7 months ago

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

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

maread99 commented 7 months ago

This would be fixed by PR #262

chfiii commented 7 months ago

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 commented 4 weeks ago

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