From a7cf38dbfb29cfd72eed2ea69139c5147aaf6a38 Mon Sep 17 00:00:00 2001 From: BaptisteDE Date: Thu, 23 Jan 2025 15:42:17 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20fix=20pandas=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tide/base.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tide/base.py b/tide/base.py index 1650ad5..ec26573 100644 --- a/tide/base.py +++ b/tide/base.py @@ -218,14 +218,16 @@ def get_gaps_dict_to_fill(self, X: pd.Series | pd.DataFrame): def get_gaps_mask(self, X: pd.Series | pd.DataFrame): gaps_dict = self.get_gaps_dict_to_fill(X) - df_mask = pd.DataFrame(index=X.index) + mask_data = {} + for col, idx_list in gaps_dict.items(): if idx_list: combined_idx = pd.concat([idx.to_series() for idx in idx_list]).index - df_mask[col] = X.index.isin(combined_idx) + mask_data[col] = X.index.isin(combined_idx) else: - df_mask[col] = np.zeros_like(X.shape[0]).astype(bool) + mask_data[col] = np.zeros(X.shape[0], dtype=bool) + df_mask = pd.DataFrame(mask_data, index=X.index) return df_mask