From ce6ea00ccb7dfbf07d1d00692d74c57fc1a3fd77 Mon Sep 17 00:00:00 2001 From: Yasemin Bridges Date: Tue, 7 Jan 2025 10:02:48 +0000 Subject: [PATCH] replace nan values with None --- src/pheval/analyse/benchmark_db_manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pheval/analyse/benchmark_db_manager.py b/src/pheval/analyse/benchmark_db_manager.py index fb69c2c6a..34dc9b5bf 100644 --- a/src/pheval/analyse/benchmark_db_manager.py +++ b/src/pheval/analyse/benchmark_db_manager.py @@ -75,6 +75,7 @@ def contains_entity_function(entity: str, known_causative_entity: str) -> bool: `False` otherwise. """ list_pattern = re.compile(r"^\[\s*(?:[^\[\],\s]+(?:\s*,\s*[^\[\],\s]+)*)?\s*]$") + entity = entity.replace("nan", "None").replace("NaN", "None") if list_pattern.match(str(entity)): list_representation = ast.literal_eval(entity) if isinstance(list_representation, list):