-
Notifications
You must be signed in to change notification settings - Fork 159
Description
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