From 86fe5796e92cc1d9dbe211ad0dde1f2b4e33b624 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Thu, 7 Nov 2024 19:43:53 +0200 Subject: [PATCH] make pd.set_option("future.no_silent_downcasting", True) conditional --- src/sssom/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sssom/util.py b/src/sssom/util.py index 2ee1d528..ab8f0241 100644 --- a/src/sssom/util.py +++ b/src/sssom/util.py @@ -168,7 +168,8 @@ def from_mapping_set_document(cls, doc: MappingSetDocument) -> "MappingSetDataFr # ! This will break when pandas >= 3.0.0 is released # https://github.com/pandas-dev/pandas/issues/57734 - pd.set_option("future.no_silent_downcasting", True) + if "future.no_silent_downcasting" in pd.options: + pd.set_option("future.no_silent_downcasting", True) df.replace("", np.nan, inplace=True) df.dropna(axis=1, how="all", inplace=True) # remove columns with all row = 'None'-s.