From ed16dec7342c5c32949f3757123362a128f883a8 Mon Sep 17 00:00:00 2001 From: Marcus Read Date: Thu, 1 Feb 2024 20:58:21 +0000 Subject: [PATCH] Fix pandas 2.2 deprecation warnings --- yahooquery/ticker.py | 4 ++-- yahooquery/utils/__init__.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yahooquery/ticker.py b/yahooquery/ticker.py index 37cb549..d68a150 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.fillna({"dividends": 0}, inplace=True) if "splits" in df.columns: - df["splits"].fillna(0, inplace=True) + df.fillna({"splits": 0}, inplace=True) return df def _adjust_ohlc(self, df): diff --git a/yahooquery/utils/__init__.py b/yahooquery/utils/__init__.py index 8fad8ac..52cb64d 100644 --- a/yahooquery/utils/__init__.py +++ b/yahooquery/utils/__init__.py @@ -1467,7 +1467,7 @@ def _get_daily_index(data, index_utc, adj_timezone): has_live_indice = False else: last_trade = pd.Timestamp.fromtimestamp(timestamp, tz="UTC") - has_live_indice = index_utc[-1] >= last_trade - pd.Timedelta(2, "S") + has_live_indice = index_utc[-1] >= last_trade - pd.Timedelta(2, "s") if has_live_indice: # remove it live_indice = index_utc[-1]