From 86659b5823029db90eff4640bbb0947424b1cf0d Mon Sep 17 00:00:00 2001 From: opnagroup <142366287+opnagroup@users.noreply.github.com> Date: Thu, 13 Mar 2025 19:34:52 -0400 Subject: [PATCH] Update ticker.py Correctly lines 1333:1334 to be compatible with pandas 3 and address futurewarning: 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. --- yahooquery/ticker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yahooquery/ticker.py b/yahooquery/ticker.py index 37cb549..e45f3ea 100644 --- a/yahooquery/ticker.py +++ b/yahooquery/ticker.py @@ -1330,9 +1330,9 @@ def _historical_data_to_dataframe(self, data, params, adj_timezone): df = pd.DataFrame(columns=["high", "low", "volume", "open", "close"]) else: if "dividends" in df.columns: - df["dividends"].fillna(0, inplace=True) + df.loc[:, "dividends"] = df["dividends"].fillna(0) if "splits" in df.columns: - df["splits"].fillna(0, inplace=True) + df.loc[:, "splits"] = df["dividends"].fillna(0) return df def _adjust_ohlc(self, df):